@sdcorejs/angular 22.3.1 → 22.3.2
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/assets/STYLE-GUIDE.md +25 -5
- package/assets/THEME.md +237 -5
- package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
- package/assets/scss/ckeditor5.scss +2 -88
- package/assets/scss/core/_control.scss +39 -0
- package/assets/scss/core/form.scss +156 -45
- package/assets/scss/core/view.scss +24 -0
- package/assets/scss/editor-content.scss +173 -0
- package/assets/scss/sd-core.scss +1 -0
- package/assets/scss/themes/_component-tokens.scss +93 -31
- package/assets/scss/themes/_material-tokens.scss +112 -0
- package/assets/scss/themes/_presets.scss +25 -0
- package/assets/scss/themes/_scales.scss +10 -0
- package/assets/scss/themes/_semantic.scss +13 -0
- package/assets/scss/themes/default.scss +8 -2
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +166 -11
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +590 -24
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +35 -3
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1906 -0
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-editor.mjs +461 -757
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +69 -37
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2192 -1179
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +12 -2
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +182 -284
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -316
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +274 -44
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +202 -43
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +581 -110
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-window.mjs +498 -0
- package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +15 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +480 -126
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +82 -13
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +77 -18
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +75 -16
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +90 -2
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +46 -5
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +56 -7
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +5 -4
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +71 -15
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1535 -22
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-BrJfOTWy.mjs +509 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-BrJfOTWy.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-DQYXx2nr.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-DQYXx2nr.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-Cjg3Dfq1.mjs +294 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-Cjg3Dfq1.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DpXg2yI7.mjs +1556 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DpXg2yI7.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +1908 -46
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
- package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services.mjs +1 -0
- package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
- package/package.json +40 -7
- package/types/sdcorejs-angular-components-avatar.d.ts +67 -2
- package/types/sdcorejs-angular-components-badge.d.ts +188 -6
- package/types/sdcorejs-angular-components-button.d.ts +20 -1
- package/types/sdcorejs-angular-components-ckeditor-styles.d.ts +3 -18
- package/types/sdcorejs-angular-components-editor-engine.d.ts +246 -0
- package/types/sdcorejs-angular-components-editor.d.ts +20 -17
- package/types/sdcorejs-angular-components-file-explorer.d.ts +4 -2
- package/types/sdcorejs-angular-components-form-generic.d.ts +246 -35
- package/types/sdcorejs-angular-components-mini-editor.d.ts +33 -70
- package/types/sdcorejs-angular-components-modal-resizable.d.ts +1 -124
- package/types/sdcorejs-angular-components-operator.d.ts +137 -8
- package/types/sdcorejs-angular-components-tab-router.d.ts +31 -18
- package/types/sdcorejs-angular-components-table.d.ts +84 -6
- package/types/sdcorejs-angular-components-window.d.ts +81 -0
- package/types/sdcorejs-angular-components.d.ts +1 -0
- package/types/sdcorejs-angular-configurations.d.ts +8 -1
- package/types/sdcorejs-angular-forms-autocomplete.d.ts +5 -0
- package/types/sdcorejs-angular-forms-chip-calendar.d.ts +163 -18
- package/types/sdcorejs-angular-forms-date-range.d.ts +24 -2
- package/types/sdcorejs-angular-forms-date.d.ts +23 -2
- package/types/sdcorejs-angular-forms-directives.d.ts +47 -2
- package/types/sdcorejs-angular-forms-input-number.d.ts +23 -2
- package/types/sdcorejs-angular-forms-input.d.ts +23 -2
- package/types/sdcorejs-angular-forms-models.d.ts +38 -3
- package/types/sdcorejs-angular-forms-select.d.ts +32 -2
- package/types/sdcorejs-angular-i18n.d.ts +302 -2
- package/types/sdcorejs-angular-modules-generic.d.ts +316 -0
- package/types/sdcorejs-angular-modules-icon.d.ts +37 -6
- package/types/sdcorejs-angular-modules-layout.d.ts +536 -86
- package/types/sdcorejs-angular-modules.d.ts +1 -0
- package/types/sdcorejs-angular-pipes.d.ts +2 -0
- package/types/sdcorejs-angular-services-date-time.d.ts +57 -0
- package/types/sdcorejs-angular-services-storage.d.ts +8 -1
- package/types/sdcorejs-angular-services.d.ts +1 -0
- package/types/sdcorejs-angular-utilities-read-state.d.ts +2 -0
- package/types/sdcorejs-angular-utilities-theme.d.ts +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, input, booleanAttribute, effect, ChangeDetectionStrategy, Component, InjectionToken, Injectable, signal, computed, Pipe,
|
|
2
|
+
import { inject, ElementRef, input, booleanAttribute, effect, ChangeDetectionStrategy, Component, InjectionToken, Injectable, signal, computed, DestroyRef, isDevMode, Pipe, ViewContainerRef, viewChild, untracked, output, isSignal, model, Injector, ChangeDetectorRef, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/common';
|
|
4
|
-
import { DOCUMENT,
|
|
4
|
+
import { DOCUMENT, NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
5
5
|
import * as i1$3 from '@angular/router';
|
|
6
|
-
import { Router, NavigationEnd, RouterModule, ActivatedRoute } from '@angular/router';
|
|
6
|
+
import { Router, NavigationEnd, RouterModule, NavigationSkipped, ActivatedRoute } from '@angular/router';
|
|
7
7
|
import { __decorate } from 'tslib';
|
|
8
8
|
import { SdAvatar, SdTabComponent, SdButton } from '@sdcorejs/angular/components';
|
|
9
9
|
import { I18nService, I18N_STORAGE_KEY, I18N_MESSAGES, SdTranslatePipe } from '@sdcorejs/angular/i18n';
|
|
@@ -24,11 +24,13 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|
|
24
24
|
import * as i3 from '@angular/material/tree';
|
|
25
25
|
import { MatTreeNestedDataSource, MatTreeModule } from '@angular/material/tree';
|
|
26
26
|
import { SdSafeHtmlPipe } from '@sdcorejs/angular/pipes';
|
|
27
|
-
import
|
|
27
|
+
import * as i1$2 from '@angular/cdk/a11y';
|
|
28
|
+
import { CdkTrapFocus, A11yModule } from '@angular/cdk/a11y';
|
|
29
|
+
import { Overlay, CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
30
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
31
|
+
import { SD_ICON_CONFIGURATION, SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
28
32
|
import { isObservable } from 'rxjs';
|
|
29
33
|
import { SdInput } from '@sdcorejs/angular/forms';
|
|
30
|
-
import * as i1$2 from '@angular/cdk/a11y';
|
|
31
|
-
import { A11yModule } from '@angular/cdk/a11y';
|
|
32
34
|
|
|
33
35
|
class SdPageComponent {
|
|
34
36
|
el = inject(ElementRef);
|
|
@@ -70,6 +72,14 @@ function searchMenuLeaves(menus, query) {
|
|
|
70
72
|
return leaves;
|
|
71
73
|
return leaves.filter(menu => [menu.title, menu.tooltipTitle].some(value => value && StringUtilities.aliasIncludes(value, normalizedQuery)));
|
|
72
74
|
}
|
|
75
|
+
/** Matches like `searchMenuLeaves` but leaves out `comingSoon` leaves and every leaf under a `comingSoon` group (sidebar V4 search). */
|
|
76
|
+
function searchAvailableMenuLeaves(menus, query) {
|
|
77
|
+
const leaves = collectAvailableMenuLeaves(menus, []);
|
|
78
|
+
const normalizedQuery = query?.trim();
|
|
79
|
+
if (!normalizedQuery)
|
|
80
|
+
return leaves;
|
|
81
|
+
return leaves.filter(menu => [menu.title, menu.tooltipTitle].some(value => value && StringUtilities.aliasIncludes(value, normalizedQuery)));
|
|
82
|
+
}
|
|
73
83
|
function selectPrimaryMenuGroups(menus, requestedIds, maximum = 3) {
|
|
74
84
|
const limit = Number.isFinite(maximum) && maximum > 0 ? Math.min(3, Math.floor(maximum)) : 3;
|
|
75
85
|
const byId = new Map(menus.filter(menu => typeof menu.id === 'string').map(menu => [menu.id, menu]));
|
|
@@ -113,6 +123,70 @@ function flattenMenuLeaves(menus) {
|
|
|
113
123
|
});
|
|
114
124
|
return leaves;
|
|
115
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Groups top-level menus by `section` in order of first appearance (sidebar V4).
|
|
128
|
+
* An unsectioned menu joins only the immediately preceding output group when that group is unsectioned (`section: null`);
|
|
129
|
+
* otherwise it starts a new unsectioned group.
|
|
130
|
+
*/
|
|
131
|
+
function groupMenusBySection(menus) {
|
|
132
|
+
const groups = [];
|
|
133
|
+
const groupBySection = new Map();
|
|
134
|
+
for (const menu of menus ?? []) {
|
|
135
|
+
if (!menu || typeof menu !== 'object')
|
|
136
|
+
continue;
|
|
137
|
+
const section = typeof menu.section === 'string' ? menu.section.trim() : '';
|
|
138
|
+
if (!section) {
|
|
139
|
+
// why: chỉ nối vào nhóm null nếu nó là nhóm cuối, để không gộp vượt qua một nhóm có section
|
|
140
|
+
const last = groups[groups.length - 1];
|
|
141
|
+
if (last?.section === null)
|
|
142
|
+
last.menus.push(menu);
|
|
143
|
+
else
|
|
144
|
+
groups.push({ section: null, menus: [menu] });
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const group = groupBySection.get(section);
|
|
148
|
+
if (group) {
|
|
149
|
+
group.menus.push(menu);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const created = { section, menus: [menu] };
|
|
153
|
+
groupBySection.set(section, created);
|
|
154
|
+
groups.push(created);
|
|
155
|
+
}
|
|
156
|
+
return groups;
|
|
157
|
+
}
|
|
158
|
+
/** The one trailing element sidebar V4 renders, in the order `comingSoon`, `badge`, `status`; empty values are skipped. */
|
|
159
|
+
function resolveMenuTrailing(menu) {
|
|
160
|
+
if (!menu || typeof menu !== 'object')
|
|
161
|
+
return null;
|
|
162
|
+
if (menu.comingSoon === true)
|
|
163
|
+
return { kind: 'soon' };
|
|
164
|
+
const badge = menu.badge;
|
|
165
|
+
if (badge && hasBadgeValue(badge.value)) {
|
|
166
|
+
return badge.tone === 'warning' || badge.tone === 'error'
|
|
167
|
+
? { kind: 'badge', value: badge.value, tone: badge.tone }
|
|
168
|
+
: { kind: 'count', value: badge.value };
|
|
169
|
+
}
|
|
170
|
+
const status = menu.status;
|
|
171
|
+
if (status && typeof status.label === 'string' && status.label.trim()) {
|
|
172
|
+
return { kind: 'status', label: status.label, tone: status.tone, live: status.live === true };
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function hasBadgeValue(value) {
|
|
177
|
+
return typeof value === 'number' ? Number.isFinite(value) : typeof value === 'string' && !!value.trim();
|
|
178
|
+
}
|
|
179
|
+
function collectAvailableMenuLeaves(menus, leaves) {
|
|
180
|
+
for (const menu of menus ?? []) {
|
|
181
|
+
if (!menu || typeof menu !== 'object' || menu.comingSoon === true)
|
|
182
|
+
continue;
|
|
183
|
+
if ('path' in menu && typeof menu.path === 'string' && menu.path)
|
|
184
|
+
leaves.push(menu);
|
|
185
|
+
if ('children' in menu && Array.isArray(menu.children))
|
|
186
|
+
collectAvailableMenuLeaves(menu.children, leaves);
|
|
187
|
+
}
|
|
188
|
+
return leaves;
|
|
189
|
+
}
|
|
116
190
|
function visitMenus(menus, ancestors, visitor) {
|
|
117
191
|
for (const menu of menus ?? []) {
|
|
118
192
|
if (!menu || typeof menu !== 'object')
|
|
@@ -135,7 +209,7 @@ function visitMenus(menus, ancestors, visitor) {
|
|
|
135
209
|
*
|
|
136
210
|
* ⚠️ `SdLayoutStorageService` là singleton `providedIn: 'root'`, thường được khởi tạo TRƯỚC khi biết
|
|
137
211
|
* người dùng là ai. Vì vậy hãy cấp một **hàm** — nó được gọi lại ở mỗi lần truy cập handle, nên khi
|
|
138
|
-
* danh tính đến (hoặc đổi) thì cả
|
|
212
|
+
* danh tính đến (hoặc đổi) thì cả tám handle tự dựng lại trên namespace mới:
|
|
139
213
|
*
|
|
140
214
|
* ```ts
|
|
141
215
|
* providers: [
|
|
@@ -160,7 +234,7 @@ class SdLayoutStorageService {
|
|
|
160
234
|
// nên nó chạy ở lần inject đầu tiên, thường TRƯỚC khi đăng nhập xong, và factory theo user trả về
|
|
161
235
|
// `undefined` cho cả phiên; biện pháp "pinned/recent của A không lộ sang B" quảng cáo trong doc khi
|
|
162
236
|
// đó không bao giờ có hiệu lực. Giải quyết bằng cách resolve LƯỜI ở mỗi lần truy cập handle: khi
|
|
163
|
-
// danh tính đến (hoặc đổi user trong cùng phiên SPA) thì
|
|
237
|
+
// danh tính đến (hoặc đổi user trong cùng phiên SPA) thì tám handle được dựng lại trên namespace mới.
|
|
164
238
|
get isShowSidebar() {
|
|
165
239
|
return this.#resolveHandles().isShowSidebar;
|
|
166
240
|
}
|
|
@@ -182,6 +256,10 @@ class SdLayoutStorageService {
|
|
|
182
256
|
get versionStates() {
|
|
183
257
|
return this.#resolveHandles().versionStates;
|
|
184
258
|
}
|
|
259
|
+
/** Snapshot context hiện tại (`{ id, title, subtitle?, avatar? }`), chỉ `SdLayoutContextService` đọc/ghi. */
|
|
260
|
+
get currentContext() {
|
|
261
|
+
return this.#resolveHandles().currentContext;
|
|
262
|
+
}
|
|
185
263
|
/**
|
|
186
264
|
* Xoá toàn bộ state layout đã persist.
|
|
187
265
|
*
|
|
@@ -198,6 +276,13 @@ class SdLayoutStorageService {
|
|
|
198
276
|
for (const handle of this.#allHandles(handles))
|
|
199
277
|
handle.remove();
|
|
200
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Namespace mà các handle đang dùng tại lúc gọi (đã trim; rỗng/không cấu hình → `undefined`).
|
|
281
|
+
* So hai lần gọi để biết partition lưu trữ đã đổi (đăng nhập/đăng xuất trong SPA).
|
|
282
|
+
*/
|
|
283
|
+
resolvedNamespace() {
|
|
284
|
+
return this.#resolveNamespace();
|
|
285
|
+
}
|
|
201
286
|
// why: namespace rỗng/space phải quy về undefined, nếu không mỗi chuỗi rác lại tạo ra một không
|
|
202
287
|
// gian lưu trữ khác và state của chính user đó biến mất sau khi reload.
|
|
203
288
|
#resolveNamespace() {
|
|
@@ -233,6 +318,7 @@ class SdLayoutStorageService {
|
|
|
233
318
|
pinnedMenuKeys: this.#sdStorageService.create('4bdc7f80-9ff4-4fe0-908f-6c9f7fe4100a', option),
|
|
234
319
|
recentMenuKeys: this.#sdStorageService.create('fb989dc1-f6e7-4b62-a611-861a8f214a51', option),
|
|
235
320
|
versionStates: this.#sdStorageService.create('ca8e4261-fbd4-4209-af88-2dbe278c1a1b', option),
|
|
321
|
+
currentContext: this.#sdStorageService.create('f628621f-7d5d-4f22-b40d-4cc5bf0fa7ae', option),
|
|
236
322
|
};
|
|
237
323
|
}
|
|
238
324
|
#allHandles(handles) {
|
|
@@ -244,6 +330,7 @@ class SdLayoutStorageService {
|
|
|
244
330
|
handles.pinnedMenuKeys,
|
|
245
331
|
handles.recentMenuKeys,
|
|
246
332
|
handles.versionStates,
|
|
333
|
+
handles.currentContext,
|
|
247
334
|
];
|
|
248
335
|
}
|
|
249
336
|
readPinnedMenuKeys(menus) {
|
|
@@ -277,6 +364,24 @@ class SdLayoutStorageService {
|
|
|
277
364
|
this.versionStates.set({ ...states, [String(version)]: nextState });
|
|
278
365
|
return nextState;
|
|
279
366
|
}
|
|
367
|
+
/** Đọc snapshot context từ bộ nhớ; trả bản sao, hoặc `null` khi chưa có hay sai dạng (thiếu/rỗng `id`, `title`). */
|
|
368
|
+
readCurrentContext() {
|
|
369
|
+
return this.#parseContext(this.currentContext.get());
|
|
370
|
+
}
|
|
371
|
+
/** Lưu snapshot context, chỉ giữ `id`, `title`, `subtitle`, `avatar`; bỏ field tuỳ chọn đang `undefined`. */
|
|
372
|
+
writeCurrentContext(context) {
|
|
373
|
+
const { id, title, subtitle, avatar } = context;
|
|
374
|
+
this.currentContext.set({ id, title, ...(subtitle === undefined ? {} : { subtitle }), ...(avatar === undefined ? {} : { avatar }) });
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Đọc lại snapshot context từ storage, bỏ qua entry trong bộ nhớ; kiểm dạng như `readCurrentContext()`.
|
|
378
|
+
*
|
|
379
|
+
* why: `set()` cập nhật bộ nhớ trước và không báo ghi lỗi, còn tab khác ghi thì entry trong bộ nhớ không
|
|
380
|
+
* đổi — chỉ `refresh()` mới cho biết giá trị thật sự đã lưu.
|
|
381
|
+
*/
|
|
382
|
+
refreshCurrentContext() {
|
|
383
|
+
return this.#parseContext(this.currentContext.refresh());
|
|
384
|
+
}
|
|
280
385
|
#getLegacyPinnedKeys() {
|
|
281
386
|
const legacyGroup = this.pinnedMenuGroup.get();
|
|
282
387
|
if (!legacyGroup || !Array.isArray(legacyGroup.children))
|
|
@@ -291,6 +396,23 @@ class SdLayoutStorageService {
|
|
|
291
396
|
#sameKeys(left, right) {
|
|
292
397
|
return left.length === right.length && left.every((key, index) => key === right[index]);
|
|
293
398
|
}
|
|
399
|
+
// why: giá trị trong storage có thể do bản cũ, tab khác hoặc tay người sửa — không tin kiểu đã khai báo.
|
|
400
|
+
#parseContext(value) {
|
|
401
|
+
if (typeof value !== 'object' || value === null)
|
|
402
|
+
return null;
|
|
403
|
+
const { id, title, subtitle, avatar } = value;
|
|
404
|
+
if (!this.#isFilledString(id) || !this.#isFilledString(title))
|
|
405
|
+
return null;
|
|
406
|
+
return {
|
|
407
|
+
id,
|
|
408
|
+
title,
|
|
409
|
+
...(typeof subtitle === 'string' ? { subtitle } : {}),
|
|
410
|
+
...(typeof avatar === 'string' ? { avatar } : {}),
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
#isFilledString(value) {
|
|
414
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
415
|
+
}
|
|
294
416
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
295
417
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutStorageService, providedIn: 'root' });
|
|
296
418
|
}
|
|
@@ -319,6 +441,10 @@ function resolveSidebarV3Recent(sidebar) {
|
|
|
319
441
|
maxItems,
|
|
320
442
|
};
|
|
321
443
|
}
|
|
444
|
+
function sanitizeSidebarV4BottomBar(bottomBar) {
|
|
445
|
+
const ids = Array.isArray(bottomBar) ? bottomBar.filter((id) => typeof id === 'string').map(id => id.trim()) : [];
|
|
446
|
+
return [...new Set(ids.filter(Boolean))].slice(0, 4);
|
|
447
|
+
}
|
|
322
448
|
function normalizeSidebarConfiguration(sidebar) {
|
|
323
449
|
if (sidebar.version === 2) {
|
|
324
450
|
return {
|
|
@@ -334,6 +460,20 @@ function normalizeSidebarConfiguration(sidebar) {
|
|
|
334
460
|
recent: resolveSidebarV3Recent(sidebar),
|
|
335
461
|
};
|
|
336
462
|
}
|
|
463
|
+
if (sidebar.version === 4) {
|
|
464
|
+
const { mobile } = sidebar;
|
|
465
|
+
return {
|
|
466
|
+
...sidebar,
|
|
467
|
+
defaultCollapsed: sidebar.defaultCollapsed ?? false,
|
|
468
|
+
// why: V4 kế thừa `recent` của V3; dùng lại đúng resolver V3 mà không nới kiểu tham số public của nó.
|
|
469
|
+
recent: resolveSidebarV3Recent({ version: 3, recent: sidebar.recent }),
|
|
470
|
+
itemShape: sidebar.itemShape === 'soft' ? 'soft' : 'pill',
|
|
471
|
+
density: sidebar.density === 'comfortable' ? 'comfortable' : 'compact',
|
|
472
|
+
collapsedGroup: sidebar.collapsedGroup === 'expand' ? 'expand' : 'flyout',
|
|
473
|
+
// why: không có `bottomBar` thì giữ nguyên `mobile` (kể cả vắng mặt) — không tự tạo bottom bar rỗng.
|
|
474
|
+
...(mobile?.bottomBar == null ? {} : { mobile: { ...mobile, bottomBar: sanitizeSidebarV4BottomBar(mobile.bottomBar) } }),
|
|
475
|
+
};
|
|
476
|
+
}
|
|
337
477
|
return sidebar;
|
|
338
478
|
}
|
|
339
479
|
const SD_LAYOUT_CONFIGURATION = new InjectionToken('sd.layout.configuration');
|
|
@@ -513,6 +653,322 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
513
653
|
}]
|
|
514
654
|
}], ctorParameters: () => [] });
|
|
515
655
|
|
|
656
|
+
/** Session storage key of the per-tab reconcile marker (id of the last context reconcile reload target). */
|
|
657
|
+
const SD_LAYOUT_CONTEXT_MARKER_KEY = 'sd.layout.context.reconcile-marker';
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Browser effects of the layout context feature: page reload, cross-tab `storage` events and the
|
|
661
|
+
* per-tab reconcile marker. Defaults to the document window; provide a fake `SdLayoutContextRuntime`
|
|
662
|
+
* in specs and demos so nothing reloads for real:
|
|
663
|
+
*
|
|
664
|
+
* ```ts
|
|
665
|
+
* providers: [{ provide: SD_LAYOUT_CONTEXT_RUNTIME, useValue: fakeRuntime }];
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
const SD_LAYOUT_CONTEXT_RUNTIME = new InjectionToken('sd.layout.context.runtime', {
|
|
669
|
+
providedIn: 'root',
|
|
670
|
+
factory: () => createSdLayoutContextBrowserRuntime(inject(DOCUMENT).defaultView),
|
|
671
|
+
});
|
|
672
|
+
/** Creates the default runtime over `view`; without a window every operation is a no-op. */
|
|
673
|
+
function createSdLayoutContextBrowserRuntime(view) {
|
|
674
|
+
if (!view) {
|
|
675
|
+
return {
|
|
676
|
+
reload: () => undefined,
|
|
677
|
+
onStorage: () => () => undefined,
|
|
678
|
+
readMarker: () => undefined,
|
|
679
|
+
writeMarker: () => false,
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
return {
|
|
683
|
+
reload: () => view.location.reload(),
|
|
684
|
+
onStorage: listener => {
|
|
685
|
+
const handler = (event) => {
|
|
686
|
+
// why: chỉ localStorage mới chứa snapshot. `localStorage.clear()` ở tab khác vẫn mang `storageArea`
|
|
687
|
+
// (chỉ `key` là null); `storageArea` null chỉ gặp ở sự kiện tự dựng — vẫn chuyển tiếp cho an toàn.
|
|
688
|
+
const area = event.storageArea;
|
|
689
|
+
if (area === null || (area !== undefined && area === readLocalStorage(view)))
|
|
690
|
+
listener();
|
|
691
|
+
};
|
|
692
|
+
view.addEventListener('storage', handler);
|
|
693
|
+
return () => view.removeEventListener('storage', handler);
|
|
694
|
+
},
|
|
695
|
+
readMarker: () => {
|
|
696
|
+
try {
|
|
697
|
+
const storage = view.sessionStorage;
|
|
698
|
+
return storage ? storage.getItem(SD_LAYOUT_CONTEXT_MARKER_KEY) : undefined;
|
|
699
|
+
}
|
|
700
|
+
catch {
|
|
701
|
+
return undefined;
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
writeMarker: value => {
|
|
705
|
+
try {
|
|
706
|
+
const storage = view.sessionStorage;
|
|
707
|
+
if (!storage)
|
|
708
|
+
return false;
|
|
709
|
+
if (value === null)
|
|
710
|
+
storage.removeItem(SD_LAYOUT_CONTEXT_MARKER_KEY);
|
|
711
|
+
else
|
|
712
|
+
storage.setItem(SD_LAYOUT_CONTEXT_MARKER_KEY, value);
|
|
713
|
+
// why: đọc lại để xác nhận — có trình duyệt nuốt lỗi ghi thay vì ném.
|
|
714
|
+
return storage.getItem(SD_LAYOUT_CONTEXT_MARKER_KEY) === value;
|
|
715
|
+
}
|
|
716
|
+
catch {
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
// why: truy cập `localStorage` có thể ném SecurityError khi trình duyệt chặn storage.
|
|
723
|
+
function readLocalStorage(view) {
|
|
724
|
+
try {
|
|
725
|
+
return view.localStorage ?? undefined;
|
|
726
|
+
}
|
|
727
|
+
catch {
|
|
728
|
+
return undefined;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Owns the current layout context (for example a store or a legal entity) and its persisted snapshot.
|
|
734
|
+
*
|
|
735
|
+
* The snapshot is captured once, when the service is first injected, so `SD_LAYOUT_STORAGE_NAMESPACE`
|
|
736
|
+
* must already resolve at that moment (see `sd-layout.md`). Switching reloads the page — there is no
|
|
737
|
+
* change event. Read the context during bootstrap:
|
|
738
|
+
*
|
|
739
|
+
* ```ts
|
|
740
|
+
* provideAppInitializer(() => {
|
|
741
|
+
* const context = inject(SdLayoutContextService).getCurrentContext();
|
|
742
|
+
* inject(ApiContextHeader).set(context?.id);
|
|
743
|
+
* });
|
|
744
|
+
* ```
|
|
745
|
+
*
|
|
746
|
+
* The service works without `SD_LAYOUT_CONFIGURATION`; the context switcher passes the configured items to
|
|
747
|
+
* `syncItems()`, which reconciles the snapshot. A reconcile reload happens at most once per target id
|
|
748
|
+
* while the per-tab marker holds that id.
|
|
749
|
+
*/
|
|
750
|
+
class SdLayoutContextService {
|
|
751
|
+
#storage = inject(SdLayoutStorageService);
|
|
752
|
+
#runtime = inject(SD_LAYOUT_CONTEXT_RUNTIME);
|
|
753
|
+
#destroyRef = inject(DestroyRef);
|
|
754
|
+
// why: chụp một lần lúc khởi tạo (D-008) — id này quyết định có cần reload đối chiếu hay không,
|
|
755
|
+
// còn namespace lúc chụp giúp nhận ra partition lưu trữ đã đổi (đăng nhập/đăng xuất trong SPA).
|
|
756
|
+
#loadTimeId;
|
|
757
|
+
#capturedNamespace;
|
|
758
|
+
#stopListening;
|
|
759
|
+
// why: đã xin reload thì trang sắp tải lại — mọi lời gọi sau trong lần load này bỏ qua, tránh ghi đè
|
|
760
|
+
// đích đang chờ, reload lần hai hay cảnh báo marker giả.
|
|
761
|
+
#reloadRequested = false;
|
|
762
|
+
#markerWarned = false;
|
|
763
|
+
#current = signal(null, /* @ts-ignore */
|
|
764
|
+
...(ngDevMode ? [{ debugName: "#current" }] : /* istanbul ignore next */ []));
|
|
765
|
+
#items = signal([], /* @ts-ignore */
|
|
766
|
+
...(ngDevMode ? [{ debugName: "#items" }] : /* istanbul ignore next */ []));
|
|
767
|
+
#switchingId = signal(null, /* @ts-ignore */
|
|
768
|
+
...(ngDevMode ? [{ debugName: "#switchingId" }] : /* istanbul ignore next */ []));
|
|
769
|
+
#switchFailed = signal(false, /* @ts-ignore */
|
|
770
|
+
...(ngDevMode ? [{ debugName: "#switchFailed" }] : /* istanbul ignore next */ []));
|
|
771
|
+
#changedElsewhere = signal(false, /* @ts-ignore */
|
|
772
|
+
...(ngDevMode ? [{ debugName: "#changedElsewhere" }] : /* istanbul ignore next */ []));
|
|
773
|
+
/** Context of this page load; title, subtitle and avatar may refresh from the configured items. */
|
|
774
|
+
current = this.#current.asReadonly();
|
|
775
|
+
/** Valid items last passed to `syncItems()` (entries without `id`/`title` and duplicate ids are dropped). */
|
|
776
|
+
items = this.#items.asReadonly();
|
|
777
|
+
/** Id of the context being switched to, or `null`. */
|
|
778
|
+
switchingId = this.#switchingId.asReadonly();
|
|
779
|
+
/** `true` when the last switch could not be persisted (no reload happened). */
|
|
780
|
+
switchFailed = this.#switchFailed.asReadonly();
|
|
781
|
+
/** `true` when another tab switched the stored context; this tab keeps its context until reloaded. */
|
|
782
|
+
changedElsewhere = this.#changedElsewhere.asReadonly();
|
|
783
|
+
constructor() {
|
|
784
|
+
const snapshot = this.#storage.readCurrentContext();
|
|
785
|
+
this.#loadTimeId = snapshot?.id ?? null;
|
|
786
|
+
this.#capturedNamespace = this.#storage.resolvedNamespace();
|
|
787
|
+
this.#current.set(snapshot);
|
|
788
|
+
}
|
|
789
|
+
/** Returns a copy of the current context, or `null` before any context was stored. */
|
|
790
|
+
getCurrentContext() {
|
|
791
|
+
const current = this.#current();
|
|
792
|
+
return current ? { ...current } : null;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Switches to the item with `id`, then reloads the page once the snapshot is confirmed in storage.
|
|
796
|
+
* Ignored for the active id, before `syncItems()`, for ids that are not in `items` and once a reload
|
|
797
|
+
* was requested in this page load.
|
|
798
|
+
*/
|
|
799
|
+
setCurrentContext(id) {
|
|
800
|
+
if (this.#reloadRequested || id === this.#current()?.id)
|
|
801
|
+
return;
|
|
802
|
+
const item = this.#items().find(entry => entry.id === id);
|
|
803
|
+
if (!item)
|
|
804
|
+
return;
|
|
805
|
+
this.#switchingId.set(id);
|
|
806
|
+
this.#switchFailed.set(false);
|
|
807
|
+
if (this.#persist(toSnapshot(item))) {
|
|
808
|
+
// why: ghi marker = đích để namespace resolve trễ không tốn thêm một reload đối chiếu ở lần load sau;
|
|
809
|
+
// ghi lỗi không chặn — người dùng chủ động chuyển nên vẫn reload.
|
|
810
|
+
this.#runtime.writeMarker(id);
|
|
811
|
+
this.#requestReload();
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
this.#switchingId.set(null);
|
|
815
|
+
this.#switchFailed.set(true);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Reconciles the stored snapshot with the configured items: a valid id only refreshes its metadata;
|
|
819
|
+
* a missing or stale id falls back to `items[0]` and reloads, unless the per-tab marker already holds
|
|
820
|
+
* that target. Empty items store nothing. While the load-time context is still in `items`, a different
|
|
821
|
+
* stored id only raises `changedElsewhere` and a removed snapshot keeps the context in memory.
|
|
822
|
+
* Repeated calls with the same items neither write nor reload again.
|
|
823
|
+
*/
|
|
824
|
+
syncItems(items) {
|
|
825
|
+
if (this.#reloadRequested)
|
|
826
|
+
return;
|
|
827
|
+
const validItems = normalizeItems(items);
|
|
828
|
+
this.#items.set(validItems);
|
|
829
|
+
// why: listener chỉ đăng ký ở lần gọi đầu (D-021) — app không cấu hình `context` không tạo listener.
|
|
830
|
+
this.#listenToStorage();
|
|
831
|
+
if (!validItems.length)
|
|
832
|
+
return;
|
|
833
|
+
const namespace = this.#storage.resolvedNamespace();
|
|
834
|
+
const namespaceChanged = namespace !== this.#capturedNamespace;
|
|
835
|
+
if (namespaceChanged)
|
|
836
|
+
this.#recapture(namespace);
|
|
837
|
+
const fresh = this.#storage.refreshCurrentContext();
|
|
838
|
+
const current = this.#current();
|
|
839
|
+
const currentItem = !namespaceChanged && current ? validItems.find(item => item.id === current.id) : undefined;
|
|
840
|
+
// why: INV-004/D-011/D-026 đứng trên D-025 bước 4 — context của lần load còn hợp lệ thì không bị thay:
|
|
841
|
+
// storage giữ id khác nghĩa là tab khác đã chuyển → chỉ báo; snapshot mất (clear() ở tab khác, hoặc
|
|
842
|
+
// lần chuyển ghi lỗi) → giữ context, chỉ làm mới metadata trong bộ nhớ. Không ghi, không marker, không reload.
|
|
843
|
+
if (currentItem && fresh?.id !== currentItem.id) {
|
|
844
|
+
if (fresh)
|
|
845
|
+
this.#changedElsewhere.set(true);
|
|
846
|
+
else
|
|
847
|
+
this.#current.set(toSnapshot(currentItem));
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
const target = toSnapshot(validItems.find(item => item.id === fresh?.id) ?? validItems[0]);
|
|
851
|
+
if (!sameContext(target, fresh) && !this.#persist(target)) {
|
|
852
|
+
this.#current.set(target);
|
|
853
|
+
// @i18n-ignore
|
|
854
|
+
this.#warn('Could not persist the current context; it is kept in memory and the page is not reloaded.');
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
this.#current.set(target);
|
|
858
|
+
if (target.id === this.#loadTimeId) {
|
|
859
|
+
this.#runtime.writeMarker(null);
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
// why: marker phiên chặn vòng lặp reload khi namespace theo user resolve SAU getCurrentContext() —
|
|
863
|
+
// mỗi lần load đều thấy id lúc load khác đích; marker cho tối đa một reload đối chiếu mỗi id đích
|
|
864
|
+
// trong lúc nó còn giữ id đó (D-025).
|
|
865
|
+
const marker = this.#runtime.readMarker();
|
|
866
|
+
if (marker === undefined || marker === target.id || !this.#runtime.writeMarker(target.id)) {
|
|
867
|
+
this.#warnMarkerBlocked();
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
this.#requestReload();
|
|
871
|
+
}
|
|
872
|
+
/** Reloads the page, for example from the "changed in another tab" notice. Does nothing once a reload was requested. */
|
|
873
|
+
reload() {
|
|
874
|
+
this.#requestReload();
|
|
875
|
+
}
|
|
876
|
+
#requestReload() {
|
|
877
|
+
if (this.#reloadRequested)
|
|
878
|
+
return;
|
|
879
|
+
this.#reloadRequested = true;
|
|
880
|
+
this.#runtime.reload();
|
|
881
|
+
}
|
|
882
|
+
// why: cảnh báo một lần mỗi instance — lời gọi lặp của switcher không làm ngập console.
|
|
883
|
+
#warnMarkerBlocked() {
|
|
884
|
+
if (this.#markerWarned)
|
|
885
|
+
return;
|
|
886
|
+
this.#markerWarned = true;
|
|
887
|
+
this.#warn(
|
|
888
|
+
// @i18n-ignore
|
|
889
|
+
'Skipped the context reconcile reload to avoid a reload loop: the per-tab marker already holds the target or is unavailable. ' +
|
|
890
|
+
// @i18n-ignore
|
|
891
|
+
'Make SD_LAYOUT_STORAGE_NAMESPACE resolvable before SdLayoutContextService is first injected (see sd-layout.md).');
|
|
892
|
+
}
|
|
893
|
+
#persist(snapshot) {
|
|
894
|
+
this.#storage.writeCurrentContext(snapshot);
|
|
895
|
+
// why: `set()` cập nhật bộ nhớ trước và không báo ghi lỗi — chỉ đọc lại từ storage mới xác nhận được (D-019).
|
|
896
|
+
return this.#storage.refreshCurrentContext()?.id === snapshot.id;
|
|
897
|
+
}
|
|
898
|
+
// why: đổi namespace (đăng nhập/đăng xuất trong SPA) là partition khác, không phải đổi ở tab khác → tắt thông báo.
|
|
899
|
+
#recapture(namespace) {
|
|
900
|
+
this.#capturedNamespace = namespace;
|
|
901
|
+
this.#current.set(this.#storage.refreshCurrentContext());
|
|
902
|
+
this.#changedElsewhere.set(false);
|
|
903
|
+
}
|
|
904
|
+
#listenToStorage() {
|
|
905
|
+
if (this.#stopListening)
|
|
906
|
+
return;
|
|
907
|
+
this.#stopListening = this.#runtime.onStorage(() => this.#onStorage());
|
|
908
|
+
this.#destroyRef.onDestroy(() => this.#stopListening?.());
|
|
909
|
+
}
|
|
910
|
+
// why: key thật là digest nên không lọc theo key được — mọi sự kiện đều đọc lại rồi so id (D-020).
|
|
911
|
+
#onStorage() {
|
|
912
|
+
if (this.#reloadRequested)
|
|
913
|
+
return;
|
|
914
|
+
const namespace = this.#storage.resolvedNamespace();
|
|
915
|
+
if (namespace !== this.#capturedNamespace) {
|
|
916
|
+
this.#recapture(namespace);
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
const fresh = this.#storage.refreshCurrentContext();
|
|
920
|
+
// why: tính lại cả hai chiều để cờ tắt khi tab khác chuyển về; snapshot bị xoá (signout nơi khác) giữ nguyên cờ.
|
|
921
|
+
if (fresh)
|
|
922
|
+
this.#changedElsewhere.set(fresh.id !== this.#current()?.id);
|
|
923
|
+
}
|
|
924
|
+
#warn(message) {
|
|
925
|
+
if (!isDevMode())
|
|
926
|
+
return;
|
|
927
|
+
// @i18n-ignore dev-facing console.warn — không cần dịch
|
|
928
|
+
console.warn(`[SdLayoutContextService] ${message}`);
|
|
929
|
+
}
|
|
930
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
931
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutContextService, providedIn: 'root' });
|
|
932
|
+
}
|
|
933
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutContextService, decorators: [{
|
|
934
|
+
type: Injectable,
|
|
935
|
+
args: [{ providedIn: 'root' }]
|
|
936
|
+
}], ctorParameters: () => [] });
|
|
937
|
+
// why: chỉ giữ đúng 4 field của snapshot và bỏ field tuỳ chọn không phải chuỗi — khớp cách
|
|
938
|
+
// `SdLayoutStorageService` đọc lại, nên so sánh ổn định và lời gọi lặp không ghi lại.
|
|
939
|
+
function toSnapshot(item) {
|
|
940
|
+
const { id, title, subtitle, avatar } = item;
|
|
941
|
+
return {
|
|
942
|
+
id,
|
|
943
|
+
title,
|
|
944
|
+
...(typeof subtitle === 'string' ? { subtitle } : {}),
|
|
945
|
+
...(typeof avatar === 'string' ? { avatar } : {}),
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
function sameContext(left, right) {
|
|
949
|
+
return !!right && left.id === right.id && left.title === right.title && left.subtitle === right.subtitle && left.avatar === right.avatar;
|
|
950
|
+
}
|
|
951
|
+
function normalizeItems(items) {
|
|
952
|
+
if (!Array.isArray(items))
|
|
953
|
+
return [];
|
|
954
|
+
const seen = new Set();
|
|
955
|
+
const result = [];
|
|
956
|
+
for (const item of items) {
|
|
957
|
+
if (typeof item !== 'object' || item === null)
|
|
958
|
+
continue;
|
|
959
|
+
const { id, title } = item;
|
|
960
|
+
// why: cùng luật hợp lệ với `SdLayoutStorageService` (chuỗi không rỗng sau trim) — mục nào ghi được thì đọc lại được.
|
|
961
|
+
if (!isFilledString(id) || !isFilledString(title) || seen.has(id))
|
|
962
|
+
continue;
|
|
963
|
+
seen.add(id);
|
|
964
|
+
result.push(item);
|
|
965
|
+
}
|
|
966
|
+
return result;
|
|
967
|
+
}
|
|
968
|
+
function isFilledString(value) {
|
|
969
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
970
|
+
}
|
|
971
|
+
|
|
516
972
|
// End
|
|
517
973
|
class MenuPipe {
|
|
518
974
|
permissionService = inject(SdPermissionService);
|
|
@@ -828,6 +1284,269 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
828
1284
|
}]
|
|
829
1285
|
}] });
|
|
830
1286
|
|
|
1287
|
+
/**
|
|
1288
|
+
* CSS variable a sidebar can set on (or above) the switcher host to size the header popover. It wins over the
|
|
1289
|
+
* width derived from `anchor`. The popover lives in the CDK overlay container, so the resolved value is copied
|
|
1290
|
+
* onto it when it opens.
|
|
1291
|
+
*/
|
|
1292
|
+
const POPOVER_WIDTH_VARIABLE = '--sd-layout-context-switcher-popover-width';
|
|
1293
|
+
/** Horizontal inset of the header popover inside its anchor (the popover is `anchor width − 2 × inset` wide). */
|
|
1294
|
+
const ANCHOR_INSET = 12;
|
|
1295
|
+
const BELOW_TRIGGER_POSITIONS = [
|
|
1296
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 6 },
|
|
1297
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -6 },
|
|
1298
|
+
];
|
|
1299
|
+
const BELOW_ANCHOR_POSITIONS = [
|
|
1300
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetX: ANCHOR_INSET },
|
|
1301
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetX: ANCHOR_INSET },
|
|
1302
|
+
];
|
|
1303
|
+
const RIGHT_POSITIONS = [
|
|
1304
|
+
{ originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: 8 },
|
|
1305
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: 8 },
|
|
1306
|
+
];
|
|
1307
|
+
let nextSheetTitleId = 0;
|
|
1308
|
+
/**
|
|
1309
|
+
* Context switcher shared by sidebar versions 1–4 and their mobile drawers.
|
|
1310
|
+
*
|
|
1311
|
+
* Forwards `configuration.items` to `SdLayoutContextService.syncItems()` and renders the service state:
|
|
1312
|
+
* the current context, the switching row and the "changed in another tab" notice. Selecting another
|
|
1313
|
+
* context calls `setCurrentContext()`, which reloads the page; there is no change event.
|
|
1314
|
+
*/
|
|
1315
|
+
class SdLayoutContextSwitcher {
|
|
1316
|
+
#context = inject(SdLayoutContextService);
|
|
1317
|
+
#iconConfiguration = inject(SD_ICON_CONFIGURATION);
|
|
1318
|
+
#overlay = inject(Overlay);
|
|
1319
|
+
#viewContainerRef = inject(ViewContainerRef);
|
|
1320
|
+
#host = inject(ElementRef);
|
|
1321
|
+
#document = inject(DOCUMENT);
|
|
1322
|
+
trigger = viewChild('trigger', /* @ts-ignore */
|
|
1323
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
1324
|
+
sheetTemplate = viewChild.required('sheet', /* @ts-ignore */
|
|
1325
|
+
...(ngDevMode ? [{ debugName: "sheetTemplate" }] : /* istanbul ignore next */ []));
|
|
1326
|
+
#sheetRef;
|
|
1327
|
+
/** Context configuration of the sidebar; nothing renders without items. */
|
|
1328
|
+
configuration = input(/* @ts-ignore */
|
|
1329
|
+
...(ngDevMode ? [undefined, { debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
1330
|
+
/** Header trigger, collapsed-rail avatar, or mobile row that opens a bottom sheet. */
|
|
1331
|
+
appearance = input('header', /* @ts-ignore */
|
|
1332
|
+
...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
1333
|
+
/** Side the desktop popover opens on; defaults to `below` for the header and `right` for the rail. The sheet ignores it. */
|
|
1334
|
+
placement = input(/* @ts-ignore */
|
|
1335
|
+
...(ngDevMode ? [undefined, { debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
1336
|
+
/**
|
|
1337
|
+
* Element the desktop popover aligns to; defaults to the trigger. Pass the sidebar header for `below`
|
|
1338
|
+
* (the popover sits under it, 12px inside both edges) and the rail or aside for `right` (the popover opens
|
|
1339
|
+
* 8px from its right edge, top-aligned with the trigger).
|
|
1340
|
+
*/
|
|
1341
|
+
anchor = input(/* @ts-ignore */
|
|
1342
|
+
...(ngDevMode ? [undefined, { debugName: "anchor" }] : /* istanbul ignore next */ []));
|
|
1343
|
+
#isOpen = signal(false, /* @ts-ignore */
|
|
1344
|
+
...(ngDevMode ? [{ debugName: "#isOpen" }] : /* istanbul ignore next */ []));
|
|
1345
|
+
/** `true` while the popover or the bottom sheet is open. */
|
|
1346
|
+
isOpen = this.#isOpen.asReadonly();
|
|
1347
|
+
query = signal('', /* @ts-ignore */
|
|
1348
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
1349
|
+
popoverWidth = signal(null, /* @ts-ignore */
|
|
1350
|
+
...(ngDevMode ? [{ debugName: "popoverWidth" }] : /* istanbul ignore next */ []));
|
|
1351
|
+
popoverOrigin = signal(null, /* @ts-ignore */
|
|
1352
|
+
...(ngDevMode ? [{ debugName: "popoverOrigin" }] : /* istanbul ignore next */ []));
|
|
1353
|
+
#failedAvatars = signal(new Set(), /* @ts-ignore */
|
|
1354
|
+
...(ngDevMode ? [{ debugName: "#failedAvatars" }] : /* istanbul ignore next */ []));
|
|
1355
|
+
sheetTitleId = `sd-layout-context-switcher-sheet-title-${nextSheetTitleId++}`;
|
|
1356
|
+
// why: Lucide chỉ render icon đã đăng ký và ném lỗi với tên lạ — `unfold_less` không có alias Lucide mặc định,
|
|
1357
|
+
// nên khi app dùng Lucide mà không tự alias thì giữ `unfold_more` (đã có alias) cho trạng thái mở.
|
|
1358
|
+
openIcon = this.#iconConfiguration.defaultFontSet === 'lucide' && !this.#iconConfiguration.lucideAliases['unfold_less']
|
|
1359
|
+
? 'unfold_more'
|
|
1360
|
+
: 'unfold_less';
|
|
1361
|
+
switchFailed = this.#context.switchFailed;
|
|
1362
|
+
changedElsewhere = this.#context.changedElsewhere;
|
|
1363
|
+
/** Normalized items of the service; empty while no configuration is bound (INV-013). */
|
|
1364
|
+
items = computed(() => (this.configuration() ? this.#context.items() : []), /* @ts-ignore */
|
|
1365
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
1366
|
+
customLabel = computed(() => this.configuration()?.label?.trim() || null, /* @ts-ignore */
|
|
1367
|
+
...(ngDevMode ? [{ debugName: "customLabel" }] : /* istanbul ignore next */ []));
|
|
1368
|
+
canOpen = computed(() => this.items().length > 1, /* @ts-ignore */
|
|
1369
|
+
...(ngDevMode ? [{ debugName: "canOpen" }] : /* istanbul ignore next */ []));
|
|
1370
|
+
searchable = computed(() => this.configuration()?.searchable ?? this.items().length > 7, /* @ts-ignore */
|
|
1371
|
+
...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
1372
|
+
activeId = computed(() => this.#context.current()?.id ?? null, /* @ts-ignore */
|
|
1373
|
+
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
1374
|
+
activeItem = computed(() => {
|
|
1375
|
+
const items = this.items();
|
|
1376
|
+
return items.find(item => item.id === this.activeId()) ?? items[0] ?? null;
|
|
1377
|
+
}, /* @ts-ignore */
|
|
1378
|
+
...(ngDevMode ? [{ debugName: "activeItem" }] : /* istanbul ignore next */ []));
|
|
1379
|
+
activeInitial = computed(() => initialOf(this.activeItem()?.title), /* @ts-ignore */
|
|
1380
|
+
...(ngDevMode ? [{ debugName: "activeInitial" }] : /* istanbul ignore next */ []));
|
|
1381
|
+
#placement = computed(() => this.placement() ?? (this.appearance() === 'rail' ? 'right' : 'below'), /* @ts-ignore */
|
|
1382
|
+
...(ngDevMode ? [{ debugName: "#placement" }] : /* istanbul ignore next */ []));
|
|
1383
|
+
positions = computed(() => {
|
|
1384
|
+
if (this.#placement() === 'right')
|
|
1385
|
+
return RIGHT_POSITIONS;
|
|
1386
|
+
return this.anchor() ? BELOW_ANCHOR_POSITIONS : BELOW_TRIGGER_POSITIONS;
|
|
1387
|
+
}, /* @ts-ignore */
|
|
1388
|
+
...(ngDevMode ? [{ debugName: "positions" }] : /* istanbul ignore next */ []));
|
|
1389
|
+
rows = computed(() => {
|
|
1390
|
+
const query = this.searchable() ? this.query().trim() : '';
|
|
1391
|
+
const activeId = this.activeId();
|
|
1392
|
+
const switchingId = this.#context.switchingId();
|
|
1393
|
+
return this.items()
|
|
1394
|
+
.filter(item => !query || [item.title, item.subtitle].some(value => !!value && StringUtilities.aliasIncludes(value, query)))
|
|
1395
|
+
.map(item => ({
|
|
1396
|
+
item,
|
|
1397
|
+
initial: initialOf(item.title),
|
|
1398
|
+
active: item.id === activeId,
|
|
1399
|
+
busy: item.id === switchingId,
|
|
1400
|
+
disabled: !!switchingId && item.id !== switchingId,
|
|
1401
|
+
}));
|
|
1402
|
+
}, /* @ts-ignore */
|
|
1403
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1404
|
+
isSwitching = computed(() => !!this.#context.switchingId(), /* @ts-ignore */
|
|
1405
|
+
...(ngDevMode ? [{ debugName: "isSwitching" }] : /* istanbul ignore next */ []));
|
|
1406
|
+
constructor() {
|
|
1407
|
+
// why: switcher chuyển items vào syncItems (D-021). Sidebar mobile có switcher nằm trong drawer/sheet render
|
|
1408
|
+
// lười cũng tự chuyển items lúc khởi tạo (EXEC-D1) — syncItems idempotent nên gọi lặp không ghi/reload thêm.
|
|
1409
|
+
// untracked để signal đọc trong service không thành dependency của effect. Không có configuration thì không
|
|
1410
|
+
// gọi — app không cấu hình context không tạo listener.
|
|
1411
|
+
effect(() => {
|
|
1412
|
+
const configuration = this.configuration();
|
|
1413
|
+
if (!configuration)
|
|
1414
|
+
return;
|
|
1415
|
+
const items = configuration.items;
|
|
1416
|
+
untracked(() => this.#context.syncItems(items));
|
|
1417
|
+
});
|
|
1418
|
+
// why: đổi appearance (thu gọn/mở rộng) hoặc còn ≤ 1 mục khi đang mở thì đóng hẳn, tránh overlay mồ côi.
|
|
1419
|
+
effect(() => {
|
|
1420
|
+
this.appearance();
|
|
1421
|
+
this.canOpen();
|
|
1422
|
+
untracked(() => this.close(false));
|
|
1423
|
+
});
|
|
1424
|
+
inject(DestroyRef).onDestroy(() => this.#disposeSheet());
|
|
1425
|
+
}
|
|
1426
|
+
/** Opens or closes the popover (header, rail) or the bottom sheet (sheet). */
|
|
1427
|
+
toggle() {
|
|
1428
|
+
if (this.#isOpen())
|
|
1429
|
+
this.close();
|
|
1430
|
+
else
|
|
1431
|
+
this.open();
|
|
1432
|
+
}
|
|
1433
|
+
/** Opens the popover or the bottom sheet; ignored with fewer than two contexts. */
|
|
1434
|
+
open() {
|
|
1435
|
+
if (this.#isOpen() || !this.canOpen())
|
|
1436
|
+
return;
|
|
1437
|
+
this.query.set('');
|
|
1438
|
+
if (this.appearance() === 'sheet') {
|
|
1439
|
+
this.#isOpen.set(true);
|
|
1440
|
+
this.#openSheet();
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
// why: đo lúc mở — popover nằm ngoài sidebar nên không kế thừa được kích thước/biến CSS của nó.
|
|
1444
|
+
this.popoverOrigin.set(this.#resolveOrigin());
|
|
1445
|
+
this.popoverWidth.set(this.#resolvePopoverWidth());
|
|
1446
|
+
this.#isOpen.set(true);
|
|
1447
|
+
}
|
|
1448
|
+
/** Closes the popover or the bottom sheet; focus returns to the trigger unless `restoreFocus` is false. */
|
|
1449
|
+
close(restoreFocus = true) {
|
|
1450
|
+
if (!this.#isOpen())
|
|
1451
|
+
return;
|
|
1452
|
+
this.#isOpen.set(false);
|
|
1453
|
+
this.query.set('');
|
|
1454
|
+
this.#disposeSheet();
|
|
1455
|
+
if (restoreFocus)
|
|
1456
|
+
this.trigger()?.nativeElement.focus();
|
|
1457
|
+
}
|
|
1458
|
+
select(row) {
|
|
1459
|
+
// why: đang chuyển thì trang sắp reload — khoá mọi lựa chọn để setCurrentContext chỉ chạy một lần (CS2).
|
|
1460
|
+
if (this.isSwitching())
|
|
1461
|
+
return;
|
|
1462
|
+
if (row.active) {
|
|
1463
|
+
this.close();
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
this.#context.setCurrentContext(row.item.id);
|
|
1467
|
+
}
|
|
1468
|
+
reload() {
|
|
1469
|
+
this.#context.reload();
|
|
1470
|
+
}
|
|
1471
|
+
onSearch(event) {
|
|
1472
|
+
this.query.set(event.target.value);
|
|
1473
|
+
}
|
|
1474
|
+
onPanelKeydown(event) {
|
|
1475
|
+
if (event.key !== 'Escape')
|
|
1476
|
+
return;
|
|
1477
|
+
event.preventDefault();
|
|
1478
|
+
// why: sheet nằm trên drawer/sheet menu (D-027) — Esc chỉ đóng sheet context, không tới handler của lớp dưới.
|
|
1479
|
+
event.stopPropagation();
|
|
1480
|
+
this.close();
|
|
1481
|
+
}
|
|
1482
|
+
showAvatarImage(item) {
|
|
1483
|
+
return !!item?.avatar && !this.#failedAvatars().has(item.avatar);
|
|
1484
|
+
}
|
|
1485
|
+
onAvatarError(url) {
|
|
1486
|
+
if (!url)
|
|
1487
|
+
return;
|
|
1488
|
+
this.#failedAvatars.update(failed => new Set(failed).add(url));
|
|
1489
|
+
}
|
|
1490
|
+
#openSheet() {
|
|
1491
|
+
const ref = this.#overlay.create({
|
|
1492
|
+
positionStrategy: this.#overlay.position().global().top('0').left('0'),
|
|
1493
|
+
width: '100%',
|
|
1494
|
+
height: '100%',
|
|
1495
|
+
scrollStrategy: this.#overlay.scrollStrategies.block(),
|
|
1496
|
+
panelClass: 'sd-layout-context-switcher-sheet-pane',
|
|
1497
|
+
});
|
|
1498
|
+
this.#sheetRef = ref;
|
|
1499
|
+
ref.attach(new TemplatePortal(this.sheetTemplate(), this.#viewContainerRef)).detectChanges();
|
|
1500
|
+
}
|
|
1501
|
+
#disposeSheet() {
|
|
1502
|
+
this.#sheetRef?.dispose();
|
|
1503
|
+
this.#sheetRef = undefined;
|
|
1504
|
+
}
|
|
1505
|
+
/** `null` keeps the trigger as origin. */
|
|
1506
|
+
#resolveOrigin() {
|
|
1507
|
+
const anchor = this.anchor();
|
|
1508
|
+
if (!anchor)
|
|
1509
|
+
return null;
|
|
1510
|
+
if (this.#placement() === 'below')
|
|
1511
|
+
return anchor;
|
|
1512
|
+
const trigger = this.trigger()?.nativeElement;
|
|
1513
|
+
if (!trigger)
|
|
1514
|
+
return anchor;
|
|
1515
|
+
// why: mở từ mép phải của anchor (rail/aside) nhưng canh đỉnh theo trigger — một điểm gốc gộp cả hai trục.
|
|
1516
|
+
const anchorRect = anchor.getBoundingClientRect();
|
|
1517
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
1518
|
+
return { x: anchorRect.right, y: triggerRect.top, width: 0, height: triggerRect.height };
|
|
1519
|
+
}
|
|
1520
|
+
#resolvePopoverWidth() {
|
|
1521
|
+
const fromVariable = this.#document.defaultView
|
|
1522
|
+
?.getComputedStyle(this.#host.nativeElement)
|
|
1523
|
+
.getPropertyValue(POPOVER_WIDTH_VARIABLE)
|
|
1524
|
+
.trim();
|
|
1525
|
+
if (fromVariable)
|
|
1526
|
+
return fromVariable;
|
|
1527
|
+
const anchor = this.anchor();
|
|
1528
|
+
if (!anchor || this.#placement() !== 'below')
|
|
1529
|
+
return null;
|
|
1530
|
+
const width = anchor.getBoundingClientRect().width - 2 * ANCHOR_INSET;
|
|
1531
|
+
return width > 0 ? `${width}px` : null;
|
|
1532
|
+
}
|
|
1533
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutContextSwitcher, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1534
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdLayoutContextSwitcher, isStandalone: true, selector: "sd-layout-context-switcher", inputs: { configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.sd-layout-context-switcher--header": "appearance() === \"header\"", "class.sd-layout-context-switcher--rail": "appearance() === \"rail\"", "class.sd-layout-context-switcher--sheet": "appearance() === \"sheet\"" }, classAttribute: "sd-layout-context-switcher" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "sheetTemplate", first: true, predicate: ["sheet"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _items = items();\n@let _appearance = appearance();\n@let _active = activeItem();\n@let _open = isOpen();\n@let _label = customLabel() ?? ('core.module.layout.context.default-label' | sdTranslate);\n@let _chooseTitle = 'core.module.layout.context.choose-title' | sdTranslate: { label: _label };\n@let _triggerName = (_active?.title ?? '') + ', ' + ('core.module.layout.context.trigger' | sdTranslate: { label: _label });\n@if (_items.length) {\n @if (!canOpen()) {\n @if (_appearance === 'rail') {\n <span\n data-context-static\n class=\"sd-layout-context-switcher__rail-avatar\"\n role=\"img\"\n [attr.title]=\"_active?.title\"\n [attr.aria-label]=\"_active?.title\">\n <ng-container\n [ngTemplateOutlet]=\"avatar\"\n [ngTemplateOutletContext]=\"{ $implicit: _active, initial: activeInitial(), active: true }\" />\n @if (changedElsewhere()) {\n <span data-context-dot class=\"sd-layout-context-switcher__dot\" aria-hidden=\"true\"></span>\n }\n </span>\n } @else {\n <span\n data-context-static\n class=\"sd-layout-context-switcher__static\"\n [class.sd-layout-context-switcher__static--sheet]=\"_appearance === 'sheet'\">\n {{ _active?.title }}\n </span>\n }\n } @else if (_appearance === 'sheet') {\n <button\n #trigger\n data-context-trigger\n type=\"button\"\n class=\"sd-layout-context-switcher__trigger sd-layout-context-switcher__trigger--sheet\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n [attr.aria-label]=\"_triggerName\"\n (click)=\"toggle()\">\n <span class=\"sd-layout-context-switcher__trigger-title\">{{ _active?.title }}</span>\n <sd-icon name=\"unfold_more\" size=\"20px\"></sd-icon>\n </button>\n } @else {\n <button\n #trigger\n data-context-trigger\n cdkOverlayOrigin\n #origin=\"cdkOverlayOrigin\"\n type=\"button\"\n class=\"sd-layout-context-switcher__trigger\"\n [class.sd-layout-context-switcher__trigger--header]=\"_appearance === 'header'\"\n [class.sd-layout-context-switcher__trigger--rail]=\"_appearance === 'rail'\"\n [class.sd-layout-context-switcher__trigger--open]=\"_open\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n [attr.aria-label]=\"_triggerName\"\n [attr.title]=\"_appearance === 'rail' ? _active?.title : null\"\n (click)=\"toggle()\">\n @if (_appearance === 'rail') {\n <span class=\"sd-layout-context-switcher__rail-avatar\">\n <ng-container\n [ngTemplateOutlet]=\"avatar\"\n [ngTemplateOutletContext]=\"{ $implicit: _active, initial: activeInitial(), active: true }\" />\n @if (changedElsewhere()) {\n <span data-context-dot class=\"sd-layout-context-switcher__dot\" aria-hidden=\"true\"></span>\n }\n </span>\n } @else {\n <span class=\"sd-layout-context-switcher__trigger-title\">{{ _active?.title }}</span>\n <sd-icon [name]=\"_open ? openIcon : 'unfold_more'\" size=\"16px\"></sd-icon>\n }\n </button>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"popoverOrigin() ?? origin\"\n [cdkConnectedOverlayOpen]=\"_open\"\n [cdkConnectedOverlayPositions]=\"positions()\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayFlexibleDimensions]=\"false\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\">\n <div\n data-context-popover\n class=\"sd-layout-context-switcher__popover\"\n [class.sd-layout-context-switcher__popover--rail]=\"_appearance === 'rail'\"\n role=\"dialog\"\n [attr.aria-label]=\"_chooseTitle\"\n [style.--sd-layout-context-switcher-popover-width]=\"popoverWidth()\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onPanelKeydown($event)\">\n @if (_appearance === 'rail' && changedElsewhere()) {\n <ng-container [ngTemplateOutlet]=\"notice\" />\n }\n <ng-container [ngTemplateOutlet]=\"list\" [ngTemplateOutletContext]=\"{ $implicit: 'popover' }\" />\n </div>\n </ng-template>\n }\n\n @if (_appearance !== 'rail' && changedElsewhere()) {\n <ng-container [ngTemplateOutlet]=\"notice\" />\n }\n}\n\n<ng-template #sheet>\n <div class=\"sd-layout-context-switcher__sheet-layer\">\n <div class=\"sd-layout-context-switcher__sheet-backdrop\" aria-hidden=\"true\" (click)=\"close()\"></div>\n <div\n data-context-sheet\n class=\"sd-layout-context-switcher__sheet\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"sheetTitleId\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onPanelKeydown($event)\">\n <span class=\"sd-layout-context-switcher__handle\" aria-hidden=\"true\"></span>\n <div class=\"sd-layout-context-switcher__sheet-header\">\n <h2 class=\"sd-layout-context-switcher__sheet-title\" [id]=\"sheetTitleId\">{{ _chooseTitle }}</h2>\n <button\n data-context-close\n type=\"button\"\n class=\"sd-layout-context-switcher__close\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"close()\">\n <sd-icon name=\"close\" size=\"22px\"></sd-icon>\n </button>\n </div>\n <ng-container [ngTemplateOutlet]=\"list\" [ngTemplateOutletContext]=\"{ $implicit: 'sheet' }\" />\n </div>\n </div>\n</ng-template>\n\n<ng-template #list let-variant>\n @let _sheet = variant === 'sheet';\n @let _switching = isSwitching();\n @if (searchable()) {\n @let _placeholder = 'core.module.layout.context.search-placeholder' | sdTranslate: { label: _label };\n <label data-context-search class=\"sd-layout-context-switcher__search\">\n <sd-icon name=\"search\" size=\"20px\"></sd-icon>\n <input\n type=\"search\"\n class=\"sd-layout-context-switcher__search-input\"\n cdkFocusInitial\n autocomplete=\"off\"\n [value]=\"query()\"\n [attr.placeholder]=\"_placeholder\"\n [attr.aria-label]=\"_placeholder\"\n (input)=\"onSearch($event)\" />\n </label>\n }\n @if (!_sheet) {\n <div data-context-label class=\"sd-layout-context-switcher__label\">{{ _label }} \u00B7 {{ _items.length }}</div>\n }\n @if (switchFailed()) {\n <div data-context-error class=\"sd-layout-context-switcher__error\" role=\"alert\">\n {{ 'core.module.layout.context.switch-failed' | sdTranslate }}\n </div>\n }\n <div class=\"sd-layout-context-switcher__list\">\n @for (row of rows(); track row.item.id) {\n @let _highlighted = row.busy || (row.active && !_switching);\n <button\n data-context-row\n type=\"button\"\n class=\"sd-layout-context-switcher__row\"\n [class.sd-layout-context-switcher__row--sheet]=\"_sheet\"\n [class.sd-layout-context-switcher__row--active]=\"row.active && !_switching\"\n [class.sd-layout-context-switcher__row--busy]=\"row.busy\"\n [attr.aria-current]=\"row.active ? 'true' : null\"\n [attr.aria-busy]=\"row.busy ? 'true' : null\"\n [attr.cdkFocusInitial]=\"row.active && !searchable() ? '' : null\"\n [disabled]=\"row.disabled\"\n (click)=\"select(row)\">\n <ng-container\n [ngTemplateOutlet]=\"avatar\"\n [ngTemplateOutletContext]=\"{ $implicit: row.item, initial: row.initial, active: _highlighted, large: _sheet }\" />\n <span class=\"sd-layout-context-switcher__row-text\">\n <span data-context-row-title class=\"sd-layout-context-switcher__row-title\">{{ row.item.title }}</span>\n @if (row.busy) {\n <span data-context-row-subtitle class=\"sd-layout-context-switcher__row-subtitle\">\n {{ 'core.module.layout.context.switching' | sdTranslate }}\n </span>\n } @else if (row.item.subtitle) {\n <span data-context-row-subtitle class=\"sd-layout-context-switcher__row-subtitle\">{{ row.item.subtitle }}</span>\n }\n </span>\n @if (row.busy) {\n <sd-icon\n class=\"sd-layout-context-switcher__row-icon sd-layout-context-switcher__spinner\"\n name=\"refresh\"\n [size]=\"_sheet ? '22px' : '20px'\"></sd-icon>\n } @else if (row.active && !_switching) {\n <sd-icon class=\"sd-layout-context-switcher__row-icon\" name=\"check\" [size]=\"_sheet ? '22px' : '20px'\"></sd-icon>\n }\n </button>\n }\n </div>\n</ng-template>\n\n<ng-template #avatar let-item let-initial=\"initial\" let-active=\"active\" let-large=\"large\">\n <span\n data-context-avatar\n class=\"sd-layout-context-switcher__avatar\"\n [class.sd-layout-context-switcher__avatar--active]=\"active\"\n [class.sd-layout-context-switcher__avatar--large]=\"large\"\n aria-hidden=\"true\">\n @if (showAvatarImage(item)) {\n <img [src]=\"item.avatar\" alt=\"\" (error)=\"onAvatarError(item.avatar)\" />\n } @else {\n {{ initial }}\n }\n </span>\n</ng-template>\n\n<ng-template #notice>\n <div data-context-notice class=\"sd-layout-context-switcher__notice\" role=\"status\">\n <span class=\"sd-layout-context-switcher__notice-text\">{{ 'core.module.layout.context.changed-elsewhere' | sdTranslate }}</span>\n <button data-context-reload type=\"button\" class=\"sd-layout-context-switcher__notice-action\" (click)=\"reload()\">\n {{ 'core.common.reload' | sdTranslate }}\n </button>\n </div>\n</ng-template>\n", styles: [":host{--sd-layout-context-switcher-hover-bg: color-mix(in srgb, var(--sd-text) 6%, transparent);--sd-layout-context-switcher-muted-ink: color-mix(in srgb, var(--sd-text) 60%, transparent);display:block;min-width:0;color:var(--sd-text)}:host(.sd-layout-context-switcher--rail){display:flex;justify-content:center}.sd-layout-context-switcher__popover,.sd-layout-context-switcher__sheet{--sd-layout-context-switcher-hover-bg: color-mix(in srgb, var(--sd-text) 6%, transparent);--sd-layout-context-switcher-muted-ink: color-mix(in srgb, var(--sd-text) 60%, transparent)}.sd-layout-context-switcher__trigger{display:inline-flex;align-items:center;max-width:100%;min-width:0;margin:0;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-layout-context-switcher__trigger:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__trigger--header{gap:2px;margin-inline-start:-6px;padding:2px 4px 2px 6px;border-radius:var(--sd-radius-12, 12px);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__trigger--header:hover,.sd-layout-context-switcher__trigger--header.sd-layout-context-switcher__trigger--open{background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__trigger--sheet{justify-content:space-between;gap:var(--sd-space-8, 8px);width:100%;min-height:44px;padding:0 var(--sd-space-12, 12px);border-radius:var(--sd-radius-999, 999px);color:var(--sd-text-secondary);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-layout-context-switcher__trigger--sheet:hover{background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__trigger-title,.sd-layout-context-switcher__static{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-layout-context-switcher__static{display:block;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__static--sheet{display:flex;align-items:center;min-height:44px;padding:0 var(--sd-space-12, 12px);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-layout-context-switcher__trigger--rail{flex:none;justify-content:center;width:28px;max-width:none;height:28px;border-radius:var(--sd-radius-8, 8px)}.sd-layout-context-switcher__trigger--rail:focus-visible{outline:2px solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px;box-shadow:none}.sd-layout-context-switcher__rail-avatar{position:relative;display:inline-flex}.sd-layout-context-switcher__dot{position:absolute;top:-3px;right:-3px;width:8px;height:8px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-primary);box-shadow:0 0 0 2px var(--sd-layout-context-switcher-dot-ring-color, var(--sd-surface))}.sd-layout-context-switcher__avatar{display:inline-flex;flex:none;align-items:center;justify-content:center;width:28px;height:28px;overflow:hidden;border-radius:var(--sd-radius-8, 8px);background:color-mix(in srgb,var(--sd-text) 10%,var(--sd-surface));color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1}.sd-layout-context-switcher__avatar img{display:block;width:100%;height:100%;object-fit:cover}.sd-layout-context-switcher__avatar--active{background:var(--sd-primary);color:var(--sd-primary-contrast)}.sd-layout-context-switcher__avatar--large{width:32px;height:32px;font-size:var(--sd-font-size-12, 12px)}.sd-layout-context-switcher__popover{box-sizing:border-box;width:var(--sd-layout-context-switcher-popover-width, min(256px, 100vw - 32px));padding:var(--sd-space-8, 8px);border:1px solid color-mix(in srgb,var(--sd-border) 45%,var(--sd-surface));border-radius:var(--sd-radius-16, 16px);background:var(--sd-surface);color:var(--sd-text);box-shadow:0 6px 24px color-mix(in srgb,var(--sd-text) 14%,transparent)}.sd-layout-context-switcher__popover--rail{width:232px}.sd-layout-context-switcher__search{display:flex;align-items:center;gap:var(--sd-space-8, 8px);height:36px;padding:0 var(--sd-space-12, 12px);border-radius:var(--sd-radius-999, 999px);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-border) 55%,var(--sd-surface));color:var(--sd-text-secondary);cursor:text}.sd-layout-context-switcher__search:focus-within{box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__search-input{flex:1;min-width:0;padding:0;border:0;background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px);appearance:none}.sd-layout-context-switcher__search-input::-webkit-search-decoration{appearance:none}.sd-layout-context-switcher__search-input::placeholder{color:var(--sd-layout-context-switcher-muted-ink)}.sd-layout-context-switcher__search-input:focus,.sd-layout-context-switcher__search-input:focus-visible{outline:none}.sd-layout-context-switcher__label{padding:10px var(--sd-space-12, 12px) var(--sd-space-4, 4px);color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-layout-context-switcher__label:first-child{padding-top:var(--sd-space-6, 6px)}.sd-layout-context-switcher__error{margin:var(--sd-space-4, 4px) var(--sd-space-12, 12px);color:var(--sd-error);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__list{display:flex;flex-direction:column;max-height:336px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.sd-layout-context-switcher__row{display:flex;flex:none;align-items:center;gap:var(--sd-space-12, 12px);width:100%;min-height:48px;margin:0;padding:0 var(--sd-space-12, 12px);border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-text);font:inherit;text-align:left;cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-layout-context-switcher__row:hover:not(:disabled){background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__row:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__row:disabled{color:var(--sd-layout-context-switcher-muted-ink);cursor:default}.sd-layout-context-switcher__row:disabled .sd-layout-context-switcher__avatar{background:color-mix(in srgb,var(--sd-text) 6%,var(--sd-surface));color:var(--sd-layout-context-switcher-muted-ink)}.sd-layout-context-switcher__row:disabled .sd-layout-context-switcher__row-subtitle{color:inherit}.sd-layout-context-switcher__row--active,.sd-layout-context-switcher__row--active:hover:not(:disabled),.sd-layout-context-switcher__row--busy,.sd-layout-context-switcher__row--busy:hover:not(:disabled){background:var(--sd-primary-light)}.sd-layout-context-switcher__row--active .sd-layout-context-switcher__row-title,.sd-layout-context-switcher__row--busy .sd-layout-context-switcher__row-title{color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.sd-layout-context-switcher__row--busy{cursor:progress}.sd-layout-context-switcher__row-text{display:flex;flex:1;flex-direction:column;min-width:0}.sd-layout-context-switcher__row-title,.sd-layout-context-switcher__row-subtitle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-layout-context-switcher__row-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.sd-layout-context-switcher__row-subtitle{color:var(--sd-text-secondary);font-size:11.5px;line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__row-icon{color:var(--sd-primary)}.sd-layout-context-switcher__spinner{animation:sd-layout-context-switcher-spin 1s linear infinite}@keyframes sd-layout-context-switcher-spin{to{transform:rotate(360deg)}}.sd-layout-context-switcher__row--sheet{gap:14px;min-height:56px;padding:0 var(--sd-space-16, 16px)}.sd-layout-context-switcher__row--sheet .sd-layout-context-switcher__row-title{font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-layout-context-switcher__row--sheet .sd-layout-context-switcher__row-subtitle{font-size:var(--sd-font-size-12, 12px)}.sd-layout-context-switcher__notice{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sd-space-4, 4px) var(--sd-space-8, 8px);margin-top:var(--sd-space-6, 6px);padding:var(--sd-space-6, 6px) var(--sd-space-6, 6px) var(--sd-space-6, 6px) var(--sd-space-10, 10px);border-radius:var(--sd-radius-12, 12px);background:var(--sd-primary-light);color:var(--sd-text);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__popover>.sd-layout-context-switcher__notice:first-child{margin:0 0 var(--sd-space-6, 6px)}.sd-layout-context-switcher__notice-text{flex:1 1 auto;min-width:0}.sd-layout-context-switcher__notice-action{min-height:28px;padding:0 var(--sd-space-10, 10px);border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-primary);font:inherit;font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.sd-layout-context-switcher__notice-action:hover{background:color-mix(in srgb,var(--sd-primary) 10%,transparent)}.sd-layout-context-switcher__notice-action:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__sheet-layer{position:relative;display:flex;flex-direction:column;justify-content:flex-end;width:100%;height:100%}.sd-layout-context-switcher__sheet-backdrop{position:absolute;inset:0;background:var(--sd-overlay-backdrop, color-mix(in srgb, var(--sd-text) 40%, transparent))}.sd-layout-context-switcher__sheet{position:relative;display:flex;flex-direction:column;box-sizing:border-box;max-height:85dvh;padding:var(--sd-space-8, 8px) var(--sd-space-8, 8px) calc(28px + env(safe-area-inset-bottom,0px));border-radius:28px 28px 0 0;background:var(--sd-surface);color:var(--sd-text)}.sd-layout-context-switcher__sheet .sd-layout-context-switcher__search{flex:none;margin:0 var(--sd-space-8, 8px) var(--sd-space-8, 8px)}.sd-layout-context-switcher__sheet .sd-layout-context-switcher__list{flex:1 1 auto;min-height:0;max-height:none}.sd-layout-context-switcher__handle{flex:none;align-self:center;width:32px;height:4px;margin:var(--sd-space-4, 4px) 0 var(--sd-space-8, 8px);border-radius:var(--sd-radius-2, 2px);background:var(--sd-border)}.sd-layout-context-switcher__sheet-header{display:flex;flex:none;align-items:center;min-height:48px;padding:0 var(--sd-space-4, 4px) 0 var(--sd-space-16, 16px)}.sd-layout-context-switcher__sheet-title{flex:1;min-width:0;margin:0;overflow:hidden;color:var(--sd-text);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-24, 24px);text-overflow:ellipsis;white-space:nowrap}.sd-layout-context-switcher__close{display:inline-flex;flex:none;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}.sd-layout-context-switcher__close:hover{background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__close:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}@media(pointer:coarse){.sd-layout-context-switcher__trigger--header,.sd-layout-context-switcher__notice-action{min-height:44px}.sd-layout-context-switcher__trigger--rail{width:44px;height:44px;margin:-8px;border-radius:var(--sd-radius-16, 16px)}.sd-layout-context-switcher__trigger--rail:focus-visible{outline-offset:-6px}.sd-layout-context-switcher__search{height:44px}}@media(prefers-reduced-motion:reduce){.sd-layout-context-switcher__trigger,.sd-layout-context-switcher__row{transition:none}.sd-layout-context-switcher__spinner{animation:none}}\n"], dependencies: [{ kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1535
|
+
}
|
|
1536
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutContextSwitcher, decorators: [{
|
|
1537
|
+
type: Component,
|
|
1538
|
+
args: [{ selector: 'sd-layout-context-switcher', standalone: true, imports: [CdkConnectedOverlay, CdkOverlayOrigin, CdkTrapFocus, NgTemplateOutlet, SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1539
|
+
class: 'sd-layout-context-switcher',
|
|
1540
|
+
'[class.sd-layout-context-switcher--header]': 'appearance() === "header"',
|
|
1541
|
+
'[class.sd-layout-context-switcher--rail]': 'appearance() === "rail"',
|
|
1542
|
+
'[class.sd-layout-context-switcher--sheet]': 'appearance() === "sheet"',
|
|
1543
|
+
}, template: "@let _items = items();\n@let _appearance = appearance();\n@let _active = activeItem();\n@let _open = isOpen();\n@let _label = customLabel() ?? ('core.module.layout.context.default-label' | sdTranslate);\n@let _chooseTitle = 'core.module.layout.context.choose-title' | sdTranslate: { label: _label };\n@let _triggerName = (_active?.title ?? '') + ', ' + ('core.module.layout.context.trigger' | sdTranslate: { label: _label });\n@if (_items.length) {\n @if (!canOpen()) {\n @if (_appearance === 'rail') {\n <span\n data-context-static\n class=\"sd-layout-context-switcher__rail-avatar\"\n role=\"img\"\n [attr.title]=\"_active?.title\"\n [attr.aria-label]=\"_active?.title\">\n <ng-container\n [ngTemplateOutlet]=\"avatar\"\n [ngTemplateOutletContext]=\"{ $implicit: _active, initial: activeInitial(), active: true }\" />\n @if (changedElsewhere()) {\n <span data-context-dot class=\"sd-layout-context-switcher__dot\" aria-hidden=\"true\"></span>\n }\n </span>\n } @else {\n <span\n data-context-static\n class=\"sd-layout-context-switcher__static\"\n [class.sd-layout-context-switcher__static--sheet]=\"_appearance === 'sheet'\">\n {{ _active?.title }}\n </span>\n }\n } @else if (_appearance === 'sheet') {\n <button\n #trigger\n data-context-trigger\n type=\"button\"\n class=\"sd-layout-context-switcher__trigger sd-layout-context-switcher__trigger--sheet\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n [attr.aria-label]=\"_triggerName\"\n (click)=\"toggle()\">\n <span class=\"sd-layout-context-switcher__trigger-title\">{{ _active?.title }}</span>\n <sd-icon name=\"unfold_more\" size=\"20px\"></sd-icon>\n </button>\n } @else {\n <button\n #trigger\n data-context-trigger\n cdkOverlayOrigin\n #origin=\"cdkOverlayOrigin\"\n type=\"button\"\n class=\"sd-layout-context-switcher__trigger\"\n [class.sd-layout-context-switcher__trigger--header]=\"_appearance === 'header'\"\n [class.sd-layout-context-switcher__trigger--rail]=\"_appearance === 'rail'\"\n [class.sd-layout-context-switcher__trigger--open]=\"_open\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n [attr.aria-label]=\"_triggerName\"\n [attr.title]=\"_appearance === 'rail' ? _active?.title : null\"\n (click)=\"toggle()\">\n @if (_appearance === 'rail') {\n <span class=\"sd-layout-context-switcher__rail-avatar\">\n <ng-container\n [ngTemplateOutlet]=\"avatar\"\n [ngTemplateOutletContext]=\"{ $implicit: _active, initial: activeInitial(), active: true }\" />\n @if (changedElsewhere()) {\n <span data-context-dot class=\"sd-layout-context-switcher__dot\" aria-hidden=\"true\"></span>\n }\n </span>\n } @else {\n <span class=\"sd-layout-context-switcher__trigger-title\">{{ _active?.title }}</span>\n <sd-icon [name]=\"_open ? openIcon : 'unfold_more'\" size=\"16px\"></sd-icon>\n }\n </button>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"popoverOrigin() ?? origin\"\n [cdkConnectedOverlayOpen]=\"_open\"\n [cdkConnectedOverlayPositions]=\"positions()\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayFlexibleDimensions]=\"false\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"close(false)\">\n <div\n data-context-popover\n class=\"sd-layout-context-switcher__popover\"\n [class.sd-layout-context-switcher__popover--rail]=\"_appearance === 'rail'\"\n role=\"dialog\"\n [attr.aria-label]=\"_chooseTitle\"\n [style.--sd-layout-context-switcher-popover-width]=\"popoverWidth()\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onPanelKeydown($event)\">\n @if (_appearance === 'rail' && changedElsewhere()) {\n <ng-container [ngTemplateOutlet]=\"notice\" />\n }\n <ng-container [ngTemplateOutlet]=\"list\" [ngTemplateOutletContext]=\"{ $implicit: 'popover' }\" />\n </div>\n </ng-template>\n }\n\n @if (_appearance !== 'rail' && changedElsewhere()) {\n <ng-container [ngTemplateOutlet]=\"notice\" />\n }\n}\n\n<ng-template #sheet>\n <div class=\"sd-layout-context-switcher__sheet-layer\">\n <div class=\"sd-layout-context-switcher__sheet-backdrop\" aria-hidden=\"true\" (click)=\"close()\"></div>\n <div\n data-context-sheet\n class=\"sd-layout-context-switcher__sheet\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"sheetTitleId\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onPanelKeydown($event)\">\n <span class=\"sd-layout-context-switcher__handle\" aria-hidden=\"true\"></span>\n <div class=\"sd-layout-context-switcher__sheet-header\">\n <h2 class=\"sd-layout-context-switcher__sheet-title\" [id]=\"sheetTitleId\">{{ _chooseTitle }}</h2>\n <button\n data-context-close\n type=\"button\"\n class=\"sd-layout-context-switcher__close\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"close()\">\n <sd-icon name=\"close\" size=\"22px\"></sd-icon>\n </button>\n </div>\n <ng-container [ngTemplateOutlet]=\"list\" [ngTemplateOutletContext]=\"{ $implicit: 'sheet' }\" />\n </div>\n </div>\n</ng-template>\n\n<ng-template #list let-variant>\n @let _sheet = variant === 'sheet';\n @let _switching = isSwitching();\n @if (searchable()) {\n @let _placeholder = 'core.module.layout.context.search-placeholder' | sdTranslate: { label: _label };\n <label data-context-search class=\"sd-layout-context-switcher__search\">\n <sd-icon name=\"search\" size=\"20px\"></sd-icon>\n <input\n type=\"search\"\n class=\"sd-layout-context-switcher__search-input\"\n cdkFocusInitial\n autocomplete=\"off\"\n [value]=\"query()\"\n [attr.placeholder]=\"_placeholder\"\n [attr.aria-label]=\"_placeholder\"\n (input)=\"onSearch($event)\" />\n </label>\n }\n @if (!_sheet) {\n <div data-context-label class=\"sd-layout-context-switcher__label\">{{ _label }} \u00B7 {{ _items.length }}</div>\n }\n @if (switchFailed()) {\n <div data-context-error class=\"sd-layout-context-switcher__error\" role=\"alert\">\n {{ 'core.module.layout.context.switch-failed' | sdTranslate }}\n </div>\n }\n <div class=\"sd-layout-context-switcher__list\">\n @for (row of rows(); track row.item.id) {\n @let _highlighted = row.busy || (row.active && !_switching);\n <button\n data-context-row\n type=\"button\"\n class=\"sd-layout-context-switcher__row\"\n [class.sd-layout-context-switcher__row--sheet]=\"_sheet\"\n [class.sd-layout-context-switcher__row--active]=\"row.active && !_switching\"\n [class.sd-layout-context-switcher__row--busy]=\"row.busy\"\n [attr.aria-current]=\"row.active ? 'true' : null\"\n [attr.aria-busy]=\"row.busy ? 'true' : null\"\n [attr.cdkFocusInitial]=\"row.active && !searchable() ? '' : null\"\n [disabled]=\"row.disabled\"\n (click)=\"select(row)\">\n <ng-container\n [ngTemplateOutlet]=\"avatar\"\n [ngTemplateOutletContext]=\"{ $implicit: row.item, initial: row.initial, active: _highlighted, large: _sheet }\" />\n <span class=\"sd-layout-context-switcher__row-text\">\n <span data-context-row-title class=\"sd-layout-context-switcher__row-title\">{{ row.item.title }}</span>\n @if (row.busy) {\n <span data-context-row-subtitle class=\"sd-layout-context-switcher__row-subtitle\">\n {{ 'core.module.layout.context.switching' | sdTranslate }}\n </span>\n } @else if (row.item.subtitle) {\n <span data-context-row-subtitle class=\"sd-layout-context-switcher__row-subtitle\">{{ row.item.subtitle }}</span>\n }\n </span>\n @if (row.busy) {\n <sd-icon\n class=\"sd-layout-context-switcher__row-icon sd-layout-context-switcher__spinner\"\n name=\"refresh\"\n [size]=\"_sheet ? '22px' : '20px'\"></sd-icon>\n } @else if (row.active && !_switching) {\n <sd-icon class=\"sd-layout-context-switcher__row-icon\" name=\"check\" [size]=\"_sheet ? '22px' : '20px'\"></sd-icon>\n }\n </button>\n }\n </div>\n</ng-template>\n\n<ng-template #avatar let-item let-initial=\"initial\" let-active=\"active\" let-large=\"large\">\n <span\n data-context-avatar\n class=\"sd-layout-context-switcher__avatar\"\n [class.sd-layout-context-switcher__avatar--active]=\"active\"\n [class.sd-layout-context-switcher__avatar--large]=\"large\"\n aria-hidden=\"true\">\n @if (showAvatarImage(item)) {\n <img [src]=\"item.avatar\" alt=\"\" (error)=\"onAvatarError(item.avatar)\" />\n } @else {\n {{ initial }}\n }\n </span>\n</ng-template>\n\n<ng-template #notice>\n <div data-context-notice class=\"sd-layout-context-switcher__notice\" role=\"status\">\n <span class=\"sd-layout-context-switcher__notice-text\">{{ 'core.module.layout.context.changed-elsewhere' | sdTranslate }}</span>\n <button data-context-reload type=\"button\" class=\"sd-layout-context-switcher__notice-action\" (click)=\"reload()\">\n {{ 'core.common.reload' | sdTranslate }}\n </button>\n </div>\n</ng-template>\n", styles: [":host{--sd-layout-context-switcher-hover-bg: color-mix(in srgb, var(--sd-text) 6%, transparent);--sd-layout-context-switcher-muted-ink: color-mix(in srgb, var(--sd-text) 60%, transparent);display:block;min-width:0;color:var(--sd-text)}:host(.sd-layout-context-switcher--rail){display:flex;justify-content:center}.sd-layout-context-switcher__popover,.sd-layout-context-switcher__sheet{--sd-layout-context-switcher-hover-bg: color-mix(in srgb, var(--sd-text) 6%, transparent);--sd-layout-context-switcher-muted-ink: color-mix(in srgb, var(--sd-text) 60%, transparent)}.sd-layout-context-switcher__trigger{display:inline-flex;align-items:center;max-width:100%;min-width:0;margin:0;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-layout-context-switcher__trigger:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__trigger--header{gap:2px;margin-inline-start:-6px;padding:2px 4px 2px 6px;border-radius:var(--sd-radius-12, 12px);color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__trigger--header:hover,.sd-layout-context-switcher__trigger--header.sd-layout-context-switcher__trigger--open{background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__trigger--sheet{justify-content:space-between;gap:var(--sd-space-8, 8px);width:100%;min-height:44px;padding:0 var(--sd-space-12, 12px);border-radius:var(--sd-radius-999, 999px);color:var(--sd-text-secondary);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-layout-context-switcher__trigger--sheet:hover{background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__trigger-title,.sd-layout-context-switcher__static{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-layout-context-switcher__static{display:block;color:var(--sd-text-secondary);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__static--sheet{display:flex;align-items:center;min-height:44px;padding:0 var(--sd-space-12, 12px);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-layout-context-switcher__trigger--rail{flex:none;justify-content:center;width:28px;max-width:none;height:28px;border-radius:var(--sd-radius-8, 8px)}.sd-layout-context-switcher__trigger--rail:focus-visible{outline:2px solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px;box-shadow:none}.sd-layout-context-switcher__rail-avatar{position:relative;display:inline-flex}.sd-layout-context-switcher__dot{position:absolute;top:-3px;right:-3px;width:8px;height:8px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-primary);box-shadow:0 0 0 2px var(--sd-layout-context-switcher-dot-ring-color, var(--sd-surface))}.sd-layout-context-switcher__avatar{display:inline-flex;flex:none;align-items:center;justify-content:center;width:28px;height:28px;overflow:hidden;border-radius:var(--sd-radius-8, 8px);background:color-mix(in srgb,var(--sd-text) 10%,var(--sd-surface));color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1}.sd-layout-context-switcher__avatar img{display:block;width:100%;height:100%;object-fit:cover}.sd-layout-context-switcher__avatar--active{background:var(--sd-primary);color:var(--sd-primary-contrast)}.sd-layout-context-switcher__avatar--large{width:32px;height:32px;font-size:var(--sd-font-size-12, 12px)}.sd-layout-context-switcher__popover{box-sizing:border-box;width:var(--sd-layout-context-switcher-popover-width, min(256px, 100vw - 32px));padding:var(--sd-space-8, 8px);border:1px solid color-mix(in srgb,var(--sd-border) 45%,var(--sd-surface));border-radius:var(--sd-radius-16, 16px);background:var(--sd-surface);color:var(--sd-text);box-shadow:0 6px 24px color-mix(in srgb,var(--sd-text) 14%,transparent)}.sd-layout-context-switcher__popover--rail{width:232px}.sd-layout-context-switcher__search{display:flex;align-items:center;gap:var(--sd-space-8, 8px);height:36px;padding:0 var(--sd-space-12, 12px);border-radius:var(--sd-radius-999, 999px);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-border) 55%,var(--sd-surface));color:var(--sd-text-secondary);cursor:text}.sd-layout-context-switcher__search:focus-within{box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__search-input{flex:1;min-width:0;padding:0;border:0;background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px);appearance:none}.sd-layout-context-switcher__search-input::-webkit-search-decoration{appearance:none}.sd-layout-context-switcher__search-input::placeholder{color:var(--sd-layout-context-switcher-muted-ink)}.sd-layout-context-switcher__search-input:focus,.sd-layout-context-switcher__search-input:focus-visible{outline:none}.sd-layout-context-switcher__label{padding:10px var(--sd-space-12, 12px) var(--sd-space-4, 4px);color:var(--sd-text-secondary);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-layout-context-switcher__label:first-child{padding-top:var(--sd-space-6, 6px)}.sd-layout-context-switcher__error{margin:var(--sd-space-4, 4px) var(--sd-space-12, 12px);color:var(--sd-error);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__list{display:flex;flex-direction:column;max-height:336px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.sd-layout-context-switcher__row{display:flex;flex:none;align-items:center;gap:var(--sd-space-12, 12px);width:100%;min-height:48px;margin:0;padding:0 var(--sd-space-12, 12px);border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-text);font:inherit;text-align:left;cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-layout-context-switcher__row:hover:not(:disabled){background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__row:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__row:disabled{color:var(--sd-layout-context-switcher-muted-ink);cursor:default}.sd-layout-context-switcher__row:disabled .sd-layout-context-switcher__avatar{background:color-mix(in srgb,var(--sd-text) 6%,var(--sd-surface));color:var(--sd-layout-context-switcher-muted-ink)}.sd-layout-context-switcher__row:disabled .sd-layout-context-switcher__row-subtitle{color:inherit}.sd-layout-context-switcher__row--active,.sd-layout-context-switcher__row--active:hover:not(:disabled),.sd-layout-context-switcher__row--busy,.sd-layout-context-switcher__row--busy:hover:not(:disabled){background:var(--sd-primary-light)}.sd-layout-context-switcher__row--active .sd-layout-context-switcher__row-title,.sd-layout-context-switcher__row--busy .sd-layout-context-switcher__row-title{color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.sd-layout-context-switcher__row--busy{cursor:progress}.sd-layout-context-switcher__row-text{display:flex;flex:1;flex-direction:column;min-width:0}.sd-layout-context-switcher__row-title,.sd-layout-context-switcher__row-subtitle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-layout-context-switcher__row-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.sd-layout-context-switcher__row-subtitle{color:var(--sd-text-secondary);font-size:11.5px;line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__row-icon{color:var(--sd-primary)}.sd-layout-context-switcher__spinner{animation:sd-layout-context-switcher-spin 1s linear infinite}@keyframes sd-layout-context-switcher-spin{to{transform:rotate(360deg)}}.sd-layout-context-switcher__row--sheet{gap:14px;min-height:56px;padding:0 var(--sd-space-16, 16px)}.sd-layout-context-switcher__row--sheet .sd-layout-context-switcher__row-title{font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.sd-layout-context-switcher__row--sheet .sd-layout-context-switcher__row-subtitle{font-size:var(--sd-font-size-12, 12px)}.sd-layout-context-switcher__notice{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sd-space-4, 4px) var(--sd-space-8, 8px);margin-top:var(--sd-space-6, 6px);padding:var(--sd-space-6, 6px) var(--sd-space-6, 6px) var(--sd-space-6, 6px) var(--sd-space-10, 10px);border-radius:var(--sd-radius-12, 12px);background:var(--sd-primary-light);color:var(--sd-text);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px)}.sd-layout-context-switcher__popover>.sd-layout-context-switcher__notice:first-child{margin:0 0 var(--sd-space-6, 6px)}.sd-layout-context-switcher__notice-text{flex:1 1 auto;min-width:0}.sd-layout-context-switcher__notice-action{min-height:28px;padding:0 var(--sd-space-10, 10px);border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-primary);font:inherit;font-weight:var(--sd-font-weight-medium, 500);cursor:pointer}.sd-layout-context-switcher__notice-action:hover{background:color-mix(in srgb,var(--sd-primary) 10%,transparent)}.sd-layout-context-switcher__notice-action:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-context-switcher__sheet-layer{position:relative;display:flex;flex-direction:column;justify-content:flex-end;width:100%;height:100%}.sd-layout-context-switcher__sheet-backdrop{position:absolute;inset:0;background:var(--sd-overlay-backdrop, color-mix(in srgb, var(--sd-text) 40%, transparent))}.sd-layout-context-switcher__sheet{position:relative;display:flex;flex-direction:column;box-sizing:border-box;max-height:85dvh;padding:var(--sd-space-8, 8px) var(--sd-space-8, 8px) calc(28px + env(safe-area-inset-bottom,0px));border-radius:28px 28px 0 0;background:var(--sd-surface);color:var(--sd-text)}.sd-layout-context-switcher__sheet .sd-layout-context-switcher__search{flex:none;margin:0 var(--sd-space-8, 8px) var(--sd-space-8, 8px)}.sd-layout-context-switcher__sheet .sd-layout-context-switcher__list{flex:1 1 auto;min-height:0;max-height:none}.sd-layout-context-switcher__handle{flex:none;align-self:center;width:32px;height:4px;margin:var(--sd-space-4, 4px) 0 var(--sd-space-8, 8px);border-radius:var(--sd-radius-2, 2px);background:var(--sd-border)}.sd-layout-context-switcher__sheet-header{display:flex;flex:none;align-items:center;min-height:48px;padding:0 var(--sd-space-4, 4px) 0 var(--sd-space-16, 16px)}.sd-layout-context-switcher__sheet-title{flex:1;min-width:0;margin:0;overflow:hidden;color:var(--sd-text);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-24, 24px);text-overflow:ellipsis;white-space:nowrap}.sd-layout-context-switcher__close{display:inline-flex;flex:none;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-text-secondary);cursor:pointer}.sd-layout-context-switcher__close:hover{background:var(--sd-layout-context-switcher-hover-bg)}.sd-layout-context-switcher__close:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary))}@media(pointer:coarse){.sd-layout-context-switcher__trigger--header,.sd-layout-context-switcher__notice-action{min-height:44px}.sd-layout-context-switcher__trigger--rail{width:44px;height:44px;margin:-8px;border-radius:var(--sd-radius-16, 16px)}.sd-layout-context-switcher__trigger--rail:focus-visible{outline-offset:-6px}.sd-layout-context-switcher__search{height:44px}}@media(prefers-reduced-motion:reduce){.sd-layout-context-switcher__trigger,.sd-layout-context-switcher__row{transition:none}.sd-layout-context-switcher__spinner{animation:none}}\n"] }]
|
|
1544
|
+
}], ctorParameters: () => [], propDecorators: { trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], sheetTemplate: [{ type: i0.ViewChild, args: ['sheet', { isSignal: true }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }] } });
|
|
1545
|
+
function initialOf(title) {
|
|
1546
|
+
const first = Array.from(title?.trim() ?? '')[0];
|
|
1547
|
+
return first ? first.toLocaleUpperCase() : '';
|
|
1548
|
+
}
|
|
1549
|
+
|
|
831
1550
|
class SdLayoutUserMenuComponent {
|
|
832
1551
|
#configuration = inject(SD_LAYOUT_CONFIGURATION, { optional: true });
|
|
833
1552
|
#destroyRef = inject(DestroyRef);
|
|
@@ -996,11 +1715,11 @@ class SdLayoutUserMenuComponent {
|
|
|
996
1715
|
return Number.isFinite(value) && Number(value) > 0 ? Math.floor(Number(value)) : 0;
|
|
997
1716
|
}
|
|
998
1717
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutUserMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
999
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdLayoutUserMenuComponent, isStandalone: true, selector: "sd-layout-user-menu", inputs: { userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, signout: { classPropertyName: "signout", publicName: "signout", isSignal: true, isRequired: false, transformFunction: null }, changePassword: { classPropertyName: "changePassword", publicName: "changePassword", isSignal: true, isRequired: false, transformFunction: null }, updateProfile: { classPropertyName: "updateProfile", publicName: "updateProfile", isSignal: true, isRequired: false, transformFunction: null }, setting: { classPropertyName: "setting", publicName: "setting", isSignal: true, isRequired: false, transformFunction: null }, notification: { classPropertyName: "notification", publicName: "notification", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, presentation: { classPropertyName: "presentation", publicName: "presentation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _presentation = presentation();\n@let _role = role();\n@let _notificationBadge = notificationBadge();\n<div class=\"sd-layout-user-menu position-relative\">\n @if (_presentation !== 'disclosure') {\n <div class=\"sd-layout-user-menu__mobile d-flex flex-column gap-8\">\n <div\n data-mobile-account-row\n class=\"sd-layout-user-menu__mobile-row sd-layout-user-menu__mobile--inline d-flex align-items-center gap-8\">\n <div data-user-summary class=\"sd-layout-user-menu__summary d-flex align-items-center gap-8 flex-1\">\n <sd-avatar [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (signoutAction()) {\n <button\n type=\"button\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action sd-layout-user-menu__signout d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n\n @if (updateProfileAction() || settingAction() || notificationAction() || changePasswordAction()) {\n <div data-mobile-account-actions class=\"sd-layout-user-menu__mobile-actions d-flex flex-column gap-4\">\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <button\n #trigger\n type=\"button\"\n data-user-trigger\n class=\"sd-layout-user-menu__trigger d-flex align-items-center text-left\"\n [class.sd-layout-user-menu__trigger--compact]=\"compact()\"\n [class.w-full]=\"!compact()\"\n [class.gap-8]=\"!compact()\"\n [class.w-56]=\"compact()\"\n [class.gap-0]=\"compact()\"\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"compact() ? displayName() : null\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\">\n <sd-avatar [src]=\"avatar()\" [size]=\"compact() ? 32 : 40\"></sd-avatar>\n @if (!compact()) {\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n </span>\n <sd-icon [name]=\"isOpen() ? 'expand_less' : 'expand_more'\"></sd-icon>\n }\n </button>\n\n @if (isOpen()) {\n <div\n #menu\n data-user-menu\n class=\"sd-layout-user-menu__popup d-flex flex-column gap-4 p-8 bg-white border border-black200 rounded-8 mat-elevation-z4\"\n role=\"menu\"\n tabindex=\"-1\"\n (keydown)=\"onMenuKeydown($event)\">\n <div data-user-identity class=\"sd-layout-user-menu__identity d-flex align-items-center gap-8 px-8 py-4\">\n <sd-avatar [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n @if (signoutAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n }\n }\n</div>\n", styles: [".sd-layout-user-menu__trigger,.sd-layout-user-menu__action{border:0;background:transparent;color:var(--sd-black500, var(--sd-text, #1a1b1f));cursor:pointer;border-radius:var(--sd-radius-8, 8px);transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-layout-user-menu__trigger:hover,.sd-layout-user-menu__action:hover{background:var(--sd-black100, var(--sd-surface-muted, #f3f3f3))}.sd-layout-user-menu__trigger:focus-visible,.sd-layout-user-menu__action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-layout-user-menu__trigger--compact{width:56px;min-height:52px;justify-content:center;gap:0;padding:0}.sd-layout-user-menu__popup{position:absolute;z-index:var(--sd-z-popover, 40);left:0;bottom:calc(100% + 8px);width:272px}.sd-layout-user-menu__popup .sd-layout-user-menu__action,.sd-layout-user-menu__mobile-actions .sd-layout-user-menu__action{width:100%}.sd-layout-user-menu__summary{min-width:0;padding:0 8px}.sd-layout-user-menu__identity{min-width:0}.sd-layout-user-menu__signout{width:auto;flex:0 0 auto;min-height:40px;white-space:nowrap}.sd-layout-user-menu__role sd-icon{width:14px;height:14px;font-size:var(--sd-font-size-14, 14px);flex:0 0 auto}.sd-layout-user-menu__badge{min-width:20px;padding:1px 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-error, #ba1a1a);color:var(--sd-white, #ffffff);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-18, 18px);text-align:center}.sd-layout-user-menu__signout:hover{background:var(--sd-error-light, #ffdad6);color:var(--sd-error-dark, var(--sd-error, #ba1a1a))}@media(prefers-reduced-motion:reduce){.sd-layout-user-menu__trigger,.sd-layout-user-menu__action{transition:none}}\n"], dependencies: [{ kind: "component", type: SdAvatar, selector: "sd-avatar", inputs: ["src", "size"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1718
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdLayoutUserMenuComponent, isStandalone: true, selector: "sd-layout-user-menu", inputs: { userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, signout: { classPropertyName: "signout", publicName: "signout", isSignal: true, isRequired: false, transformFunction: null }, changePassword: { classPropertyName: "changePassword", publicName: "changePassword", isSignal: true, isRequired: false, transformFunction: null }, updateProfile: { classPropertyName: "updateProfile", publicName: "updateProfile", isSignal: true, isRequired: false, transformFunction: null }, setting: { classPropertyName: "setting", publicName: "setting", isSignal: true, isRequired: false, transformFunction: null }, notification: { classPropertyName: "notification", publicName: "notification", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, presentation: { classPropertyName: "presentation", publicName: "presentation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _presentation = presentation();\n@let _role = role();\n@let _notificationBadge = notificationBadge();\n<div class=\"sd-layout-user-menu position-relative\">\n @if (_presentation !== 'disclosure') {\n <div class=\"sd-layout-user-menu__mobile d-flex flex-column gap-8\">\n <div\n data-mobile-account-row\n class=\"sd-layout-user-menu__mobile-row sd-layout-user-menu__mobile--inline d-flex align-items-center gap-8\">\n <div data-user-summary class=\"sd-layout-user-menu__summary d-flex align-items-center gap-8 flex-1\">\n <sd-avatar aria-hidden=\"true\" [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (signoutAction()) {\n <button\n type=\"button\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action sd-layout-user-menu__signout d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n\n @if (updateProfileAction() || settingAction() || notificationAction() || changePasswordAction()) {\n <div data-mobile-account-actions class=\"sd-layout-user-menu__mobile-actions d-flex flex-column gap-4\">\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <button\n #trigger\n type=\"button\"\n data-user-trigger\n class=\"sd-layout-user-menu__trigger d-flex align-items-center text-left\"\n [class.sd-layout-user-menu__trigger--compact]=\"compact()\"\n [class.w-full]=\"!compact()\"\n [class.gap-8]=\"!compact()\"\n [class.w-56]=\"compact()\"\n [class.gap-0]=\"compact()\"\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"compact() ? displayName() : null\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\">\n <sd-avatar aria-hidden=\"true\" [src]=\"avatar()\" [size]=\"compact() ? 32 : 40\"></sd-avatar>\n @if (!compact()) {\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n </span>\n <sd-icon [name]=\"isOpen() ? 'expand_less' : 'expand_more'\"></sd-icon>\n }\n </button>\n\n @if (isOpen()) {\n <div\n #menu\n data-user-menu\n class=\"sd-layout-user-menu__popup d-flex flex-column gap-4 p-8 bg-white border border-black200 rounded-8 mat-elevation-z4\"\n role=\"menu\"\n tabindex=\"-1\"\n (keydown)=\"onMenuKeydown($event)\">\n <div data-user-identity class=\"sd-layout-user-menu__identity d-flex align-items-center gap-8 px-8 py-4\">\n <sd-avatar aria-hidden=\"true\" [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n @if (signoutAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n }\n }\n</div>\n", styles: [".sd-layout-user-menu__trigger,.sd-layout-user-menu__action{border:0;background:transparent;color:var(--sd-black500, var(--sd-text, #1a1b1f));cursor:pointer;border-radius:var(--sd-radius-8, 8px);transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-layout-user-menu__trigger:hover,.sd-layout-user-menu__action:hover{background:var(--sd-black100, var(--sd-surface-muted, #f3f3f3))}.sd-layout-user-menu__trigger:focus-visible,.sd-layout-user-menu__action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-layout-user-menu__trigger--compact{width:56px;min-height:52px;justify-content:center;gap:0;padding:0}.sd-layout-user-menu__popup{position:absolute;z-index:var(--sd-z-popover, 40);left:0;bottom:calc(100% + 8px);width:272px}.sd-layout-user-menu__popup .sd-layout-user-menu__action,.sd-layout-user-menu__mobile-actions .sd-layout-user-menu__action{width:100%}.sd-layout-user-menu__summary{min-width:0;padding:0 8px}.sd-layout-user-menu__identity{min-width:0}.sd-layout-user-menu__signout{width:auto;flex:0 0 auto;min-height:40px;white-space:nowrap}.sd-layout-user-menu__role sd-icon{width:14px;height:14px;font-size:var(--sd-font-size-14, 14px);flex:0 0 auto}.sd-layout-user-menu__badge{min-width:20px;padding:1px 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-error, #ba1a1a);color:var(--sd-white, #ffffff);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-18, 18px);text-align:center}.sd-layout-user-menu__signout:hover{background:var(--sd-error-light, #ffdad6);color:var(--sd-error-dark, var(--sd-error, #ba1a1a))}@media(prefers-reduced-motion:reduce){.sd-layout-user-menu__trigger,.sd-layout-user-menu__action{transition:none}}\n"], dependencies: [{ kind: "component", type: SdAvatar, selector: "sd-avatar", inputs: ["src", "size", "name", "status", "statusLabel", "statusPulse", "tooltip"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1000
1719
|
}
|
|
1001
1720
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutUserMenuComponent, decorators: [{
|
|
1002
1721
|
type: Component,
|
|
1003
|
-
args: [{ selector: 'sd-layout-user-menu', standalone: true, imports: [SdAvatar, SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _presentation = presentation();\n@let _role = role();\n@let _notificationBadge = notificationBadge();\n<div class=\"sd-layout-user-menu position-relative\">\n @if (_presentation !== 'disclosure') {\n <div class=\"sd-layout-user-menu__mobile d-flex flex-column gap-8\">\n <div\n data-mobile-account-row\n class=\"sd-layout-user-menu__mobile-row sd-layout-user-menu__mobile--inline d-flex align-items-center gap-8\">\n <div data-user-summary class=\"sd-layout-user-menu__summary d-flex align-items-center gap-8 flex-1\">\n <sd-avatar [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (signoutAction()) {\n <button\n type=\"button\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action sd-layout-user-menu__signout d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n\n @if (updateProfileAction() || settingAction() || notificationAction() || changePasswordAction()) {\n <div data-mobile-account-actions class=\"sd-layout-user-menu__mobile-actions d-flex flex-column gap-4\">\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <button\n #trigger\n type=\"button\"\n data-user-trigger\n class=\"sd-layout-user-menu__trigger d-flex align-items-center text-left\"\n [class.sd-layout-user-menu__trigger--compact]=\"compact()\"\n [class.w-full]=\"!compact()\"\n [class.gap-8]=\"!compact()\"\n [class.w-56]=\"compact()\"\n [class.gap-0]=\"compact()\"\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"compact() ? displayName() : null\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\">\n <sd-avatar [src]=\"avatar()\" [size]=\"compact() ? 32 : 40\"></sd-avatar>\n @if (!compact()) {\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n </span>\n <sd-icon [name]=\"isOpen() ? 'expand_less' : 'expand_more'\"></sd-icon>\n }\n </button>\n\n @if (isOpen()) {\n <div\n #menu\n data-user-menu\n class=\"sd-layout-user-menu__popup d-flex flex-column gap-4 p-8 bg-white border border-black200 rounded-8 mat-elevation-z4\"\n role=\"menu\"\n tabindex=\"-1\"\n (keydown)=\"onMenuKeydown($event)\">\n <div data-user-identity class=\"sd-layout-user-menu__identity d-flex align-items-center gap-8 px-8 py-4\">\n <sd-avatar [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n @if (signoutAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n }\n }\n</div>\n", styles: [".sd-layout-user-menu__trigger,.sd-layout-user-menu__action{border:0;background:transparent;color:var(--sd-black500, var(--sd-text, #1a1b1f));cursor:pointer;border-radius:var(--sd-radius-8, 8px);transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-layout-user-menu__trigger:hover,.sd-layout-user-menu__action:hover{background:var(--sd-black100, var(--sd-surface-muted, #f3f3f3))}.sd-layout-user-menu__trigger:focus-visible,.sd-layout-user-menu__action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-layout-user-menu__trigger--compact{width:56px;min-height:52px;justify-content:center;gap:0;padding:0}.sd-layout-user-menu__popup{position:absolute;z-index:var(--sd-z-popover, 40);left:0;bottom:calc(100% + 8px);width:272px}.sd-layout-user-menu__popup .sd-layout-user-menu__action,.sd-layout-user-menu__mobile-actions .sd-layout-user-menu__action{width:100%}.sd-layout-user-menu__summary{min-width:0;padding:0 8px}.sd-layout-user-menu__identity{min-width:0}.sd-layout-user-menu__signout{width:auto;flex:0 0 auto;min-height:40px;white-space:nowrap}.sd-layout-user-menu__role sd-icon{width:14px;height:14px;font-size:var(--sd-font-size-14, 14px);flex:0 0 auto}.sd-layout-user-menu__badge{min-width:20px;padding:1px 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-error, #ba1a1a);color:var(--sd-white, #ffffff);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-18, 18px);text-align:center}.sd-layout-user-menu__signout:hover{background:var(--sd-error-light, #ffdad6);color:var(--sd-error-dark, var(--sd-error, #ba1a1a))}@media(prefers-reduced-motion:reduce){.sd-layout-user-menu__trigger,.sd-layout-user-menu__action{transition:none}}\n"] }]
|
|
1722
|
+
args: [{ selector: 'sd-layout-user-menu', standalone: true, imports: [SdAvatar, SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _presentation = presentation();\n@let _role = role();\n@let _notificationBadge = notificationBadge();\n<div class=\"sd-layout-user-menu position-relative\">\n @if (_presentation !== 'disclosure') {\n <div class=\"sd-layout-user-menu__mobile d-flex flex-column gap-8\">\n <div\n data-mobile-account-row\n class=\"sd-layout-user-menu__mobile-row sd-layout-user-menu__mobile--inline d-flex align-items-center gap-8\">\n <div data-user-summary class=\"sd-layout-user-menu__summary d-flex align-items-center gap-8 flex-1\">\n <sd-avatar aria-hidden=\"true\" [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (signoutAction()) {\n <button\n type=\"button\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action sd-layout-user-menu__signout d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n\n @if (updateProfileAction() || settingAction() || notificationAction() || changePasswordAction()) {\n <div data-mobile-account-actions class=\"sd-layout-user-menu__mobile-actions d-flex flex-column gap-4\">\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <button\n #trigger\n type=\"button\"\n data-user-trigger\n class=\"sd-layout-user-menu__trigger d-flex align-items-center text-left\"\n [class.sd-layout-user-menu__trigger--compact]=\"compact()\"\n [class.w-full]=\"!compact()\"\n [class.gap-8]=\"!compact()\"\n [class.w-56]=\"compact()\"\n [class.gap-0]=\"compact()\"\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"compact() ? displayName() : null\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\">\n <sd-avatar aria-hidden=\"true\" [src]=\"avatar()\" [size]=\"compact() ? 32 : 40\"></sd-avatar>\n @if (!compact()) {\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n </span>\n <sd-icon [name]=\"isOpen() ? 'expand_less' : 'expand_more'\"></sd-icon>\n }\n </button>\n\n @if (isOpen()) {\n <div\n #menu\n data-user-menu\n class=\"sd-layout-user-menu__popup d-flex flex-column gap-4 p-8 bg-white border border-black200 rounded-8 mat-elevation-z4\"\n role=\"menu\"\n tabindex=\"-1\"\n (keydown)=\"onMenuKeydown($event)\">\n <div data-user-identity class=\"sd-layout-user-menu__identity d-flex align-items-center gap-8 px-8 py-4\">\n <sd-avatar aria-hidden=\"true\" [src]=\"avatar()\" [size]=\"40\"></sd-avatar>\n <span class=\"d-flex flex-column flex-1 overflow-hidden\">\n <span class=\"T14M text-ellipsis\">{{ displayName() }}</span>\n @if (userInfo().email) {\n <span class=\"T12R text-black400 text-ellipsis\">{{ userInfo().email }}</span>\n }\n @if (_role) {\n <span\n data-user-role\n class=\"sd-layout-user-menu__role d-flex align-items-center gap-4 T12R text-ellipsis\"\n [style.color]=\"_role.color\">\n @if (_role.icon) {\n <sd-icon [name]=\"_role.icon\"></sd-icon>\n }\n {{ _role.text }}\n </span>\n }\n </span>\n </div>\n @if (updateProfileAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"update-profile\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runUpdateProfile()\">\n <sd-icon name=\"edit\"></sd-icon>\n {{ 'core.module.layout.user.update-profile' | sdTranslate }}\n </button>\n }\n @if (settingAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"setting\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runSetting()\">\n <sd-icon name=\"settings\"></sd-icon>\n {{ 'core.module.layout.user.setting' | sdTranslate }}\n </button>\n }\n @if (notificationAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"notification\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runNotification()\">\n <sd-icon name=\"notifications\"></sd-icon>\n <span class=\"flex-1\">{{ 'core.module.layout.user.notification' | sdTranslate }}</span>\n @if (_notificationBadge) {\n <span data-notification-badge class=\"sd-layout-user-menu__badge\">{{ _notificationBadge }}</span>\n }\n </button>\n }\n @if (changePasswordAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"change-password\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left\"\n (click)=\"runChangePassword()\">\n <sd-icon name=\"lock\"></sd-icon>\n {{ 'core.module.layout.user.change-password' | sdTranslate }}\n </button>\n }\n @if (signoutAction()) {\n <button\n type=\"button\"\n role=\"menuitem\"\n data-user-action=\"signout\"\n class=\"sd-layout-user-menu__action d-flex align-items-center gap-8 px-8 py-8 T14R text-left text-error\"\n (click)=\"runSignout()\">\n <sd-icon name=\"logout\"></sd-icon>\n {{ 'core.module.layout.user.logout' | sdTranslate }}\n </button>\n }\n </div>\n }\n }\n</div>\n", styles: [".sd-layout-user-menu__trigger,.sd-layout-user-menu__action{border:0;background:transparent;color:var(--sd-black500, var(--sd-text, #1a1b1f));cursor:pointer;border-radius:var(--sd-radius-8, 8px);transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-layout-user-menu__trigger:hover,.sd-layout-user-menu__action:hover{background:var(--sd-black100, var(--sd-surface-muted, #f3f3f3))}.sd-layout-user-menu__trigger:focus-visible,.sd-layout-user-menu__action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-layout-user-menu__trigger--compact{width:56px;min-height:52px;justify-content:center;gap:0;padding:0}.sd-layout-user-menu__popup{position:absolute;z-index:var(--sd-z-popover, 40);left:0;bottom:calc(100% + 8px);width:272px}.sd-layout-user-menu__popup .sd-layout-user-menu__action,.sd-layout-user-menu__mobile-actions .sd-layout-user-menu__action{width:100%}.sd-layout-user-menu__summary{min-width:0;padding:0 8px}.sd-layout-user-menu__identity{min-width:0}.sd-layout-user-menu__signout{width:auto;flex:0 0 auto;min-height:40px;white-space:nowrap}.sd-layout-user-menu__role sd-icon{width:14px;height:14px;font-size:var(--sd-font-size-14, 14px);flex:0 0 auto}.sd-layout-user-menu__badge{min-width:20px;padding:1px 6px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-error, #ba1a1a);color:var(--sd-white, #ffffff);font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-18, 18px);text-align:center}.sd-layout-user-menu__signout:hover{background:var(--sd-error-light, #ffdad6);color:var(--sd-error-dark, var(--sd-error, #ba1a1a))}@media(prefers-reduced-motion:reduce){.sd-layout-user-menu__trigger,.sd-layout-user-menu__action{transition:none}}\n"] }]
|
|
1004
1723
|
}], ctorParameters: () => [], propDecorators: { trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], menu: [{ type: i0.ViewChild, args: ['menu', { isSignal: true }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], signout: [{ type: i0.Input, args: [{ isSignal: true, alias: "signout", required: false }] }], changePassword: [{ type: i0.Input, args: [{ isSignal: true, alias: "changePassword", required: false }] }], updateProfile: [{ type: i0.Input, args: [{ isSignal: true, alias: "updateProfile", required: false }] }], setting: [{ type: i0.Input, args: [{ isSignal: true, alias: "setting", required: false }] }], notification: [{ type: i0.Input, args: [{ isSignal: true, alias: "notification", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], presentation: [{ type: i0.Input, args: [{ isSignal: true, alias: "presentation", required: false }] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
1005
1724
|
|
|
1006
1725
|
let LayoutUserComponent$1 = class LayoutUserComponent {
|
|
@@ -1061,6 +1780,12 @@ class SdSidebarV1Panel {
|
|
|
1061
1780
|
popupUserMenuOpened = output();
|
|
1062
1781
|
showSideBar = output();
|
|
1063
1782
|
// ==========================================
|
|
1783
|
+
// CONTEXT SWITCHER (chỉ render khi cấu hình `sidebar.context`)
|
|
1784
|
+
// ==========================================
|
|
1785
|
+
headerContextSwitcher = viewChild('headerContextSwitcher', /* @ts-ignore */
|
|
1786
|
+
...(ngDevMode ? [{ debugName: "headerContextSwitcher" }] : /* istanbul ignore next */ []));
|
|
1787
|
+
#isContextPopoverOpen = false;
|
|
1788
|
+
// ==========================================
|
|
1064
1789
|
// STATE SIGNALS
|
|
1065
1790
|
// ==========================================
|
|
1066
1791
|
isMenuLock = signal(this.#layoutStorageService.menuLockStatus?.get() ?? true, /* @ts-ignore */
|
|
@@ -1131,6 +1856,23 @@ class SdSidebarV1Panel {
|
|
|
1131
1856
|
this.#isFirstBindingMenu.set(false);
|
|
1132
1857
|
});
|
|
1133
1858
|
});
|
|
1859
|
+
// why: popover context nằm trong overlay CDK có backdrop phủ màn hình — chuột rời sidenav thì main thu gọn
|
|
1860
|
+
// sidebar đang mở tạm (hover) và huỷ luôn switcher. Báo qua cặp output popup như menu người dùng để main giữ
|
|
1861
|
+
// sidebar mở. Chỉ bản header: báo từ rail sẽ làm main mở rộng sidebar và thay mất switcher rail đang mở.
|
|
1862
|
+
effect(() => {
|
|
1863
|
+
const isOpen = this.headerContextSwitcher()?.isOpen() ?? false;
|
|
1864
|
+
untracked(() => {
|
|
1865
|
+
if (isOpen === this.#isContextPopoverOpen)
|
|
1866
|
+
return;
|
|
1867
|
+
this.#isContextPopoverOpen = isOpen;
|
|
1868
|
+
if (isOpen) {
|
|
1869
|
+
this.popupUserMenuOpened.emit();
|
|
1870
|
+
}
|
|
1871
|
+
else {
|
|
1872
|
+
this.popupUserMenuClosed.emit();
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
});
|
|
1134
1876
|
}
|
|
1135
1877
|
#setupSubscriptions() {
|
|
1136
1878
|
this.#router.events.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
@@ -1616,7 +2358,7 @@ class SdSidebarV1Panel {
|
|
|
1616
2358
|
return count;
|
|
1617
2359
|
};
|
|
1618
2360
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV1Panel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1619
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV1Panel, isStandalone: true, selector: "sd-sidebar-v1-panel", inputs: { isShowSidebar: { classPropertyName: "isShowSidebar", publicName: "isShowSidebar", isSignal: true, isRequired: true, transformFunction: null }, menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: true, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null }, isMobile: { classPropertyName: "isMobile", publicName: "isMobile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandSideBar: "expandSideBar", popupUserMenuClosed: "popupUserMenuClosed", popupUserMenuOpened: "popupUserMenuOpened", showSideBar: "showSideBar" }, ngImport: i0, template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n@let _isShowSidebar = isShowSidebar();\n@let _searchText = searchText();\n@let _currentPath = currentPath();\n@let _activeMenuPath = activeMenuPath();\n@let _idMenuGroupActive = idMenuGroupActive();\n@let _pinnedMenuGroup = pinnedMenuGroup();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"wrapper\"\n [style.--sidebar-accent]=\"_sidebar.brandColor || 'var(--sd-primary, #005cbb)'\"\n [style.height]=\"isMobile() ? '100dvh' : '100%'\">\n <div class=\"c-header\">\n <div class=\"c-logo\">\n <a\n href=\"/layout/home\"\n [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\"\n (click)=\"$event.preventDefault(); openHomePage()\">\n @if (logoUrl(); as _logoUrl) {\n <img alt=\"\" [src]=\"_logoUrl\" />\n } @else {\n <sd-icon fontSet=\"material-icons-outlined\" name=\"apps\"></sd-icon>\n }\n </a>\n </div>\n <div class=\"c-title-menu-group\" [class.d-none]=\"!_isShowSidebar\">\n <span>{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n </div>\n </div>\n <div class=\"c-body\">\n <div class=\"c-menu\">\n <div class=\"c-menu-group\">\n @if (_sidebar?.pin?.enabled && _pinnedMenuGroup.children?.length) {\n <button\n type=\"button\"\n [attr.aria-label]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, _pinnedMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, _pinnedMenuGroup)\"\n (click)=\"expandPinnedGroup()\"\n [matTooltip]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color: isPinnedMenuGroupActive()\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor: isPinnedMenuGroupActive()\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n name=\"push_pin\"></sd-icon>\n </button>\n }\n @for (nodeMenuGroup of menus(); track nodeMenuGroup.id) {\n <button\n type=\"button\"\n [attr.aria-label]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, nodeMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, nodeMenuGroup)\"\n (click)=\"expandMenuGroup(nodeMenuGroup)\"\n [matTooltip]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n @if (nodeMenuGroup.iconUrl) {\n <span\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <img width=\"24px\" height=\"24px\" [src]=\"nodeMenuGroup.iconUrl\" [alt]=\"nodeMenuGroup.title\" />\n </span>\n } @else {\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n [name]=\"nodeMenuGroup.icon || 'widgets'\"></sd-icon>\n }\n </button>\n }\n </div>\n <div class=\"c-menu-tree\" [class.d-none]=\"!_isShowSidebar\" [attr.inert]=\"!_isShowSidebar ? '' : null\">\n @if (totalMenuInMenusByGroup() > 10) {\n <div class=\"c-menu-tree-search\">\n @let _searchLabel = 'core.module.layout.sidebar.search' | sdTranslate;\n <div class=\"c-menu-search-field\">\n <sd-icon\n class=\"c-menu-search-icon\"\n fontSet=\"material-icons-outlined\"\n name=\"search\"\n size=\"18px\"\n aria-hidden=\"true\"></sd-icon>\n <input\n #menuSearch\n class=\"c-menu-search-input\"\n type=\"search\"\n autocomplete=\"off\"\n [attr.aria-label]=\"_searchLabel\"\n [placeholder]=\"_searchLabel\"\n data-autoId=\"layout-v1-menu-search\"\n [ngModel]=\"_searchText\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onFilterSearchText($event)\" />\n @if (_searchText) {\n <button\n type=\"button\"\n class=\"c-menu-search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"onClearSearchText(); menuSearch.focus()\">\n <sd-icon fontSet=\"material-icons-outlined\" name=\"close\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"c-menu-tree-container\">\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" [style.backgroundColor]=\"'transparent'\">\n <mat-nested-tree-node *matTreeNodeDef=\"let node; when: !hasChild\">\n <div\n class=\"c-menu-node\"\n [class.is-active]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\"\n [ngStyle]=\"{\n backgroundColor:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <div class=\"c-menu-node-description\" [class.d-none]=\"!_isShowSidebar\">\n <a\n class=\"c-menu-node-description-content\"\n [href]=\"menuNodeHref(node)\"\n [attr.aria-current]=\"(_currentPath | menuFocus: node : _activeMenuPath) ? 'page' : null\"\n (click)=\"onMenuNodeClick($event, node)\"\n [ngStyle]=\"{\n color:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text, #1a1b1f)',\n }\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </a>\n\n <!-- why: n\u00FAt ghim tr\u01B0\u1EDBc \u0111\u00E2y l\u00E0 <sd-icon fontSet=\"material-icons-outlined\" (click)> \u2014 custom element kh\u00F4ng nh\u1EADn\n focus b\u00E0n ph\u00EDm v\u00E0 kh\u00F4ng c\u00F3 t\u00EAn kh\u1EA3 truy c\u1EADp, n\u00EAn kh\u00F4ng ghim \u0111\u01B0\u1EE3c b\u1EB1ng ph\u00EDm.\n \u0110\u1ED5i sang <button type=\"button\"> + aria-pressed, gi\u1ED1ng pattern \u0111\u00E3 d\u00F9ng \u1EDF\n `shared/menu-tree`. -->\n @if (_sidebar?.pin?.enabled) {\n <button\n type=\"button\"\n class=\"c-menu-node-description-icon-pin\"\n [style.opacity]=\"isPinnedNode(node) || isHoveredNode(node) ? '1' : null\"\n [style.color]=\"\n isPinnedNode(node) || isHoveredNode(node) ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)' : null\n \"\n [attr.aria-pressed]=\"isPinnedNode(node)\"\n [attr.aria-label]=\"\n (isPinnedNode(node) ? 'core.module.layout.menu.unpin' : 'core.module.layout.menu.pin')\n | sdTranslate: { title: node.title }\n \"\n (click)=\"onTogglePin($event, node)\">\n <sd-icon fontSet=\"material-icons-outlined\" size=\"18px\" name=\"push_pin\"></sd-icon>\n </button>\n }\n </div>\n </div>\n </mat-nested-tree-node>\n\n <mat-nested-tree-node\n *matTreeNodeDef=\"let node; when: hasChild\"\n [class]=\"{ expanded: treeControl.isExpanded(node), isfocus: _currentPath | menuFocus: node : _activeMenuPath }\">\n <div\n class=\"c-menu-node\"\n [class.is-ancestor]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\">\n <div class=\"d-flex align-items-center\" style=\"gap: 10px; width: 100%\">\n <button\n type=\"button\"\n [class.d-none]=\"!_isShowSidebar\"\n class=\"c-menu-node-description\"\n [attr.aria-expanded]=\"treeControl.isExpanded(node)\"\n (click)=\"onToggleMenuNode(node)\">\n <span class=\"c-menu-node-description-content\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </span>\n <sd-icon\n fontSet=\"material-icons-outlined\"\n aria-hidden=\"true\"\n size=\"18px\"\n class=\"c-menu-node-description-icon-expand\"\n [name]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n </div>\n </div>\n <div class=\"c-menu-node-group\" role=\"group\" [class.d-none]=\"!treeControl.isExpanded(node)\">\n <ng-container matTreeNodeOutlet></ng-container>\n </div>\n </mat-nested-tree-node>\n </mat-tree>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"c-footer\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"isMobile()\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\"\n [isShowSidebar]=\"_isShowSidebar\"\n (toggleMenuLock)=\"toggleMenuLock($event)\">\n </lib-layout-user>\n </div>\n </div>\n}\n", styles: ["::ng-deep .mat-mdc-tooltip-panel:has(.c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140){pointer-events:none}:host{display:block;height:100%}.wrapper{--sidebar-surface: var(--sd-white, #fff);--sidebar-rail: color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 35%, var(--sidebar-surface));--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);position:relative;display:flex;flex-direction:column;width:min(304px,100vw);color:var(--sidebar-ink);background:linear-gradient(to right,var(--sidebar-rail) 56px,var(--sidebar-surface) 56px)}.wrapper,.wrapper *{box-sizing:border-box}.wrapper:before{content:\"\";position:absolute;inset:0 auto 0 55px;width:1px;background:var(--sidebar-line);pointer-events:none}.c-header{flex:0 0 auto;display:grid;grid-template-columns:56px minmax(0,1fr);min-height:42px}.c-logo{grid-column:1;display:grid;place-items:center;height:42px}.c-logo a{display:grid;place-items:center;width:38px;height:40px;border-radius:9px;color:var(--sidebar-muted)}.c-logo img{width:30px;height:30px;object-fit:contain}.c-title-menu-group{grid-column:2;display:flex;align-items:center;min-width:0;padding:10px 14px 12px;color:var(--sidebar-ink);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;overflow-wrap:anywhere}.c-body{flex:1;min-height:0;overflow:hidden}.c-menu{display:flex;height:100%}.c-menu-group{display:flex;flex:0 0 56px;flex-direction:column;align-items:center;gap:10px;width:56px;min-height:0;margin-bottom:86px;padding:5px 0 8px;overflow-y:auto;scrollbar-width:none}.c-menu-group>button{flex:0 0 auto;border-radius:9px}.c-menu-group .c-menu-group-icon{display:flex;align-items:center;justify-content:center;width:38px;height:40px;min-height:40px;border-radius:9px;font-size:var(--sd-font-size-22, 22px)}.c-menu-group .c-menu-group-icon img{width:22px;height:22px;object-fit:contain}.c-menu-tree{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.c-menu-tree-search{flex:0 0 auto;padding:0 14px 12px;border-bottom:1px solid var(--sidebar-line)}.c-menu-search-field{display:flex;align-items:center;gap:8px;height:36px;padding:0 9px;border:1px solid var(--sidebar-line);border-radius:7px;background:var(--sidebar-rail);color:var(--sidebar-muted)}.c-menu-search-field:hover{border-color:color-mix(in srgb,var(--sidebar-muted) 35%,var(--sidebar-surface))}.c-menu-search-field:focus-within{border-color:color-mix(in srgb,var(--sidebar-accent, var(--sd-primary, #005cbb)) 75%,var(--sidebar-surface));background:var(--sidebar-surface)}.c-menu-search-icon{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);pointer-events:none}.c-menu-search-input{flex:1 1 0;width:0;min-width:0;height:100%;margin:0;padding:0;border:0;border-radius:0;outline:none;box-shadow:none;appearance:none;background:transparent;color:var(--sidebar-ink);font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-20, 20px)}.c-menu-search-input:focus,.c-menu-search-input:focus-visible{outline:none;box-shadow:none}.c-menu-search-input::placeholder{color:var(--sidebar-muted);opacity:1}.c-menu-search-input::-webkit-search-decoration,.c-menu-search-input::-webkit-search-cancel-button{appearance:none}.c-menu-search-clear{display:grid;flex:0 0 24px;place-items:center;width:24px;min-width:24px;height:24px;margin:0;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);cursor:pointer}.c-menu-search-clear sd-icon,.c-menu-search-clear mat-icon{width:18px;height:18px;font-size:var(--sd-font-size-18, 18px)}.c-menu-search-clear:hover{background:color-mix(in srgb,var(--sidebar-ink) 7%,transparent);color:var(--sidebar-ink)}.c-menu-search-clear:focus-visible{outline:1px solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.c-menu-tree-container{flex:1;min-height:0;padding:10px 8px 14px;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent;overscroll-behavior:contain}.c-menu-node{position:relative;display:flex;align-items:center;width:100%;min-height:40px;margin:2px 0;padding:0;border-radius:7px;cursor:pointer;color:var(--sidebar-ink);font-size:var(--sd-font-size-13, 13px);line-height:1.4}.c-menu-node-description{display:flex;flex:1;align-items:center;gap:6px;width:100%;min-width:0;min-height:40px;padding:0;border:0;border-radius:inherit;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.c-menu-node-description-content{display:flex;flex:1;align-items:center;align-self:stretch;gap:9px;min-width:0;padding:8px;color:inherit;font:inherit;font-weight:var(--sd-font-weight-medium, 500);text-decoration:none}.c-menu-node-label{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}.c-menu-node-icon{flex:0 0 20px;width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);object-fit:contain;color:var(--sidebar-muted)}.c-menu-node-description-icon-expand,.c-menu-node-description-icon-pin{display:flex;flex:0 0 20px;align-items:center;justify-content:center;width:20px;height:24px;margin-right:6px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);font-size:var(--sd-font-size-18, 18px);cursor:pointer}.c-menu-node-description-icon-pin{opacity:0}.c-menu-node-description-icon-pin:focus-visible{opacity:1!important}.c-menu-node.is-ancestor{color:var(--sidebar-accent)}.c-menu-node.is-ancestor .c-menu-node-description-content,.c-menu-node.is-ancestor .c-menu-node-icon,.c-menu-node.is-ancestor .c-menu-node-description-icon-expand{color:inherit}.c-menu-node.is-active{color:var(--sidebar-accent)}.c-menu-node.is-active .c-menu-node-icon{color:inherit}.c-menu-node.is-active:before{content:\"\";position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:var(--sd-radius-2, 2px);background:var(--sidebar-accent)}.c-menu-node-group{position:relative;margin:0 0 7px 19px;padding:1px 0 1px 16px;border-left:1px solid var(--sidebar-line)}.c-menu-node-group .c-menu-node{min-height:34px;border-radius:var(--sd-radius-6, 6px)}.c-menu-node-group .c-menu-node-description-content{padding:7px 8px;font-weight:var(--sd-font-weight-regular, 400)}.c-menu-node-group .c-menu-node-description{min-height:34px}.c-menu-node-group .c-menu-node-icon{display:none}.c-menu-node-group .c-menu-node.is-active:before{left:-18px}.c-menu-node-group .c-menu-node.is-active .c-menu-node-description-content,.c-menu-node-group .c-menu-node.is-ancestor .c-menu-node-description-content{font-weight:var(--sd-font-weight-medium, 500)}.c-menu-node-group .c-menu-node-group{margin-left:8px;padding-left:7px}.c-menu-node-group .c-menu-node-group .c-menu-node.is-active:before{left:-9px}.c-footer{position:absolute;bottom:0;left:0;width:56px;height:86px;background:var(--sidebar-rail)}a:focus-visible,button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:-2px}@media(pointer:coarse){.c-menu-node,.c-menu-node-group .c-menu-node,.c-menu-node-description,.c-menu-node-group .c-menu-node-description{min-height:44px}}@media(prefers-reduced-motion:reduce){.c-menu-group-icon,.c-menu-node,.c-menu-node *{transition:none!important}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i3.MatNestedTreeNode, selector: "mat-nested-tree-node", inputs: ["matNestedTreeNode", "disabled", "tabIndex"], outputs: ["activation", "expandedChange"], exportAs: ["matNestedTreeNode"] }, { kind: "directive", type: i3.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "component", type: i3.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i3.MatTreeNodeOutlet, selector: "[matTreeNodeOutlet]" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: LayoutUserComponent$1, selector: "lib-layout-user", inputs: ["isMobileOrTablet", "isMenuLock", "isShowSidebar", "userInfo"], outputs: ["menuClosed", "menuOpened", "toggleMenuLock"] }, { kind: "pipe", type: SdSafeHtmlPipe, name: "sdSafeHtml" }, { kind: "pipe", type: MenuFocusPipe, name: "menuFocus" }, { kind: "pipe", type: HighlightSearchPipe, name: "highLightSearch" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2361
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV1Panel, isStandalone: true, selector: "sd-sidebar-v1-panel", inputs: { isShowSidebar: { classPropertyName: "isShowSidebar", publicName: "isShowSidebar", isSignal: true, isRequired: true, transformFunction: null }, menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: true, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null }, isMobile: { classPropertyName: "isMobile", publicName: "isMobile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandSideBar: "expandSideBar", popupUserMenuClosed: "popupUserMenuClosed", popupUserMenuOpened: "popupUserMenuOpened", showSideBar: "showSideBar" }, viewQueries: [{ propertyName: "headerContextSwitcher", first: true, predicate: ["headerContextSwitcher"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n@let _isShowSidebar = isShowSidebar();\n@let _searchText = searchText();\n@let _currentPath = currentPath();\n@let _activeMenuPath = activeMenuPath();\n@let _idMenuGroupActive = idMenuGroupActive();\n@let _pinnedMenuGroup = pinnedMenuGroup();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"wrapper\"\n [style.--sidebar-accent]=\"_sidebar.brandColor || 'var(--sd-primary, #005cbb)'\"\n [style.height]=\"isMobile() ? '100dvh' : '100%'\">\n <div #headerElement class=\"c-header\">\n <div #logoElement class=\"c-logo\">\n <a\n href=\"/layout/home\"\n [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\"\n (click)=\"$event.preventDefault(); openHomePage()\">\n @if (logoUrl(); as _logoUrl) {\n <img alt=\"\" [src]=\"_logoUrl\" />\n } @else {\n <sd-icon fontSet=\"material-icons-outlined\" name=\"apps\"></sd-icon>\n }\n </a>\n </div>\n <!-- Context switcher (D-010): avatar ngay d\u01B0\u1EDBi logo khi thu g\u1ECDn v\u1EC1 rail, d\u00F2ng ph\u1EE5 d\u01B0\u1EDBi ti\u00EAu \u0111\u1EC1 khi m\u1EDF. -->\n @if (_sidebar.context && !_isShowSidebar) {\n <sd-layout-context-switcher class=\"c-rail-context\" appearance=\"rail\" [configuration]=\"_sidebar.context\" [anchor]=\"logoElement\" />\n }\n <div class=\"c-title-menu-group\" [class.d-none]=\"!_isShowSidebar\" [class.c-title-menu-group--context]=\"!!_sidebar.context\">\n <span>{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n @if (_sidebar.context && _isShowSidebar) {\n <sd-layout-context-switcher\n #headerContextSwitcher\n class=\"c-header-context\"\n appearance=\"header\"\n [configuration]=\"_sidebar.context\"\n [anchor]=\"headerElement\" />\n }\n </div>\n </div>\n <div class=\"c-body\">\n <div class=\"c-menu\">\n <div class=\"c-menu-group\">\n @if (_sidebar?.pin?.enabled && _pinnedMenuGroup.children?.length) {\n <button\n type=\"button\"\n [attr.aria-label]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, _pinnedMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, _pinnedMenuGroup)\"\n (click)=\"expandPinnedGroup()\"\n [matTooltip]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color: isPinnedMenuGroupActive()\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor: isPinnedMenuGroupActive()\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n name=\"push_pin\"></sd-icon>\n </button>\n }\n @for (nodeMenuGroup of menus(); track nodeMenuGroup.id) {\n <button\n type=\"button\"\n [attr.aria-label]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, nodeMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, nodeMenuGroup)\"\n (click)=\"expandMenuGroup(nodeMenuGroup)\"\n [matTooltip]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n @if (nodeMenuGroup.iconUrl) {\n <span\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <img width=\"24px\" height=\"24px\" [src]=\"nodeMenuGroup.iconUrl\" [alt]=\"nodeMenuGroup.title\" />\n </span>\n } @else {\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n [name]=\"nodeMenuGroup.icon || 'widgets'\"></sd-icon>\n }\n </button>\n }\n </div>\n <div class=\"c-menu-tree\" [class.d-none]=\"!_isShowSidebar\" [attr.inert]=\"!_isShowSidebar ? '' : null\">\n @if (totalMenuInMenusByGroup() > 10) {\n <div class=\"c-menu-tree-search\">\n @let _searchLabel = 'core.module.layout.sidebar.search' | sdTranslate;\n <div class=\"c-menu-search-field\">\n <sd-icon\n class=\"c-menu-search-icon\"\n fontSet=\"material-icons-outlined\"\n name=\"search\"\n size=\"18px\"\n aria-hidden=\"true\"></sd-icon>\n <input\n #menuSearch\n class=\"c-menu-search-input\"\n type=\"search\"\n autocomplete=\"off\"\n [attr.aria-label]=\"_searchLabel\"\n [placeholder]=\"_searchLabel\"\n data-autoId=\"layout-v1-menu-search\"\n [ngModel]=\"_searchText\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onFilterSearchText($event)\" />\n @if (_searchText) {\n <button\n type=\"button\"\n class=\"c-menu-search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"onClearSearchText(); menuSearch.focus()\">\n <sd-icon fontSet=\"material-icons-outlined\" name=\"close\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"c-menu-tree-container\">\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" [style.backgroundColor]=\"'transparent'\">\n <mat-nested-tree-node *matTreeNodeDef=\"let node; when: !hasChild\">\n <div\n class=\"c-menu-node\"\n [class.is-active]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\"\n [ngStyle]=\"{\n backgroundColor:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <div class=\"c-menu-node-description\" [class.d-none]=\"!_isShowSidebar\">\n <a\n class=\"c-menu-node-description-content\"\n [href]=\"menuNodeHref(node)\"\n [attr.aria-current]=\"(_currentPath | menuFocus: node : _activeMenuPath) ? 'page' : null\"\n (click)=\"onMenuNodeClick($event, node)\"\n [ngStyle]=\"{\n color:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text, #1a1b1f)',\n }\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </a>\n\n <!-- why: n\u00FAt ghim tr\u01B0\u1EDBc \u0111\u00E2y l\u00E0 <sd-icon fontSet=\"material-icons-outlined\" (click)> \u2014 custom element kh\u00F4ng nh\u1EADn\n focus b\u00E0n ph\u00EDm v\u00E0 kh\u00F4ng c\u00F3 t\u00EAn kh\u1EA3 truy c\u1EADp, n\u00EAn kh\u00F4ng ghim \u0111\u01B0\u1EE3c b\u1EB1ng ph\u00EDm.\n \u0110\u1ED5i sang <button type=\"button\"> + aria-pressed, gi\u1ED1ng pattern \u0111\u00E3 d\u00F9ng \u1EDF\n `shared/menu-tree`. -->\n @if (_sidebar?.pin?.enabled) {\n <button\n type=\"button\"\n class=\"c-menu-node-description-icon-pin\"\n [style.opacity]=\"isPinnedNode(node) || isHoveredNode(node) ? '1' : null\"\n [style.color]=\"\n isPinnedNode(node) || isHoveredNode(node) ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)' : null\n \"\n [attr.aria-pressed]=\"isPinnedNode(node)\"\n [attr.aria-label]=\"\n (isPinnedNode(node) ? 'core.module.layout.menu.unpin' : 'core.module.layout.menu.pin')\n | sdTranslate: { title: node.title }\n \"\n (click)=\"onTogglePin($event, node)\">\n <sd-icon fontSet=\"material-icons-outlined\" size=\"18px\" name=\"push_pin\"></sd-icon>\n </button>\n }\n </div>\n </div>\n </mat-nested-tree-node>\n\n <mat-nested-tree-node\n *matTreeNodeDef=\"let node; when: hasChild\"\n [class]=\"{ expanded: treeControl.isExpanded(node), isfocus: _currentPath | menuFocus: node : _activeMenuPath }\">\n <div\n class=\"c-menu-node\"\n [class.is-ancestor]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\">\n <div class=\"d-flex align-items-center\" style=\"gap: 10px; width: 100%\">\n <button\n type=\"button\"\n [class.d-none]=\"!_isShowSidebar\"\n class=\"c-menu-node-description\"\n [attr.aria-expanded]=\"treeControl.isExpanded(node)\"\n (click)=\"onToggleMenuNode(node)\">\n <span class=\"c-menu-node-description-content\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </span>\n <sd-icon\n fontSet=\"material-icons-outlined\"\n aria-hidden=\"true\"\n size=\"18px\"\n class=\"c-menu-node-description-icon-expand\"\n [name]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n </div>\n </div>\n <div class=\"c-menu-node-group\" role=\"group\" [class.d-none]=\"!treeControl.isExpanded(node)\">\n <ng-container matTreeNodeOutlet></ng-container>\n </div>\n </mat-nested-tree-node>\n </mat-tree>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"c-footer\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"isMobile()\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\"\n [isShowSidebar]=\"_isShowSidebar\"\n (toggleMenuLock)=\"toggleMenuLock($event)\">\n </lib-layout-user>\n </div>\n </div>\n}\n", styles: ["::ng-deep .mat-mdc-tooltip-panel:has(.c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140){pointer-events:none}:host{display:block;height:100%}.wrapper{--sidebar-surface: var(--sd-white, #fff);--sidebar-rail: color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 35%, var(--sidebar-surface));--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);position:relative;display:flex;flex-direction:column;width:min(304px,100vw);color:var(--sidebar-ink);background:linear-gradient(to right,var(--sidebar-rail) 56px,var(--sidebar-surface) 56px)}.wrapper,.wrapper *{box-sizing:border-box}.wrapper:before{content:\"\";position:absolute;inset:0 auto 0 55px;width:1px;background:var(--sidebar-line);pointer-events:none}.c-header{flex:0 0 auto;display:grid;grid-template-columns:56px minmax(0,1fr);min-height:42px}.c-logo{grid-column:1;display:grid;place-items:center;height:42px}.c-logo a{display:grid;place-items:center;width:38px;height:40px;border-radius:9px;color:var(--sidebar-muted)}.c-logo img{width:30px;height:30px;object-fit:contain}.c-title-menu-group{grid-column:2;display:flex;align-items:center;min-width:0;padding:10px 14px 12px;color:var(--sidebar-ink);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;overflow-wrap:anywhere}.c-title-menu-group--context{--sd-layout-context-switcher-popover-width: calc(min(304px, 100vw) - 24px) ;flex-direction:column;align-items:stretch;justify-content:center}.c-header-context{font-weight:var(--sd-font-weight-regular, 400);letter-spacing:normal}.c-rail-context{grid-column:1;grid-row:2}.c-rail-context:not(:empty){margin:4px 0 6px}@media(pointer:coarse){.c-rail-context:not(:empty){margin-top:8px}}.c-body{flex:1;min-height:0;overflow:hidden}.c-menu{display:flex;height:100%}.c-menu-group{display:flex;flex:0 0 56px;flex-direction:column;align-items:center;gap:10px;width:56px;min-height:0;margin-bottom:86px;padding:5px 0 8px;overflow-y:auto;scrollbar-width:none}.c-menu-group>button{flex:0 0 auto;border-radius:9px}.c-menu-group .c-menu-group-icon{display:flex;align-items:center;justify-content:center;width:38px;height:40px;min-height:40px;border-radius:9px;font-size:var(--sd-font-size-22, 22px)}.c-menu-group .c-menu-group-icon img{width:22px;height:22px;object-fit:contain}.c-menu-tree{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.c-menu-tree-search{flex:0 0 auto;padding:0 14px 12px;border-bottom:1px solid var(--sidebar-line)}.c-menu-search-field{display:flex;align-items:center;gap:8px;height:36px;padding:0 9px;border:1px solid var(--sidebar-line);border-radius:7px;background:var(--sidebar-rail);color:var(--sidebar-muted)}.c-menu-search-field:hover{border-color:color-mix(in srgb,var(--sidebar-muted) 35%,var(--sidebar-surface))}.c-menu-search-field:focus-within{border-color:color-mix(in srgb,var(--sidebar-accent, var(--sd-primary, #005cbb)) 75%,var(--sidebar-surface));background:var(--sidebar-surface)}.c-menu-search-icon{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);pointer-events:none}.c-menu-search-input{flex:1 1 0;width:0;min-width:0;height:100%;margin:0;padding:0;border:0;border-radius:0;outline:none;box-shadow:none;appearance:none;background:transparent;color:var(--sidebar-ink);font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-20, 20px)}.c-menu-search-input:focus,.c-menu-search-input:focus-visible{outline:none;box-shadow:none}.c-menu-search-input::placeholder{color:var(--sidebar-muted);opacity:1}.c-menu-search-input::-webkit-search-decoration,.c-menu-search-input::-webkit-search-cancel-button{appearance:none}.c-menu-search-clear{display:grid;flex:0 0 24px;place-items:center;width:24px;min-width:24px;height:24px;margin:0;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);cursor:pointer}.c-menu-search-clear sd-icon,.c-menu-search-clear mat-icon{width:18px;height:18px;font-size:var(--sd-font-size-18, 18px)}.c-menu-search-clear:hover{background:color-mix(in srgb,var(--sidebar-ink) 7%,transparent);color:var(--sidebar-ink)}.c-menu-search-clear:focus-visible{outline:1px solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.c-menu-tree-container{flex:1;min-height:0;padding:10px 8px 14px;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent;overscroll-behavior:contain}.c-menu-node{position:relative;display:flex;align-items:center;width:100%;min-height:40px;margin:2px 0;padding:0;border-radius:7px;cursor:pointer;color:var(--sidebar-ink);font-size:var(--sd-font-size-13, 13px);line-height:1.4}.c-menu-node-description{display:flex;flex:1;align-items:center;gap:6px;width:100%;min-width:0;min-height:40px;padding:0;border:0;border-radius:inherit;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.c-menu-node-description-content{display:flex;flex:1;align-items:center;align-self:stretch;gap:9px;min-width:0;padding:8px;color:inherit;font:inherit;font-weight:var(--sd-font-weight-medium, 500);text-decoration:none}.c-menu-node-label{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}.c-menu-node-icon{flex:0 0 20px;width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);object-fit:contain;color:var(--sidebar-muted)}.c-menu-node-description-icon-expand,.c-menu-node-description-icon-pin{display:flex;flex:0 0 20px;align-items:center;justify-content:center;width:20px;height:24px;margin-right:6px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);font-size:var(--sd-font-size-18, 18px);cursor:pointer}.c-menu-node-description-icon-pin{opacity:0}.c-menu-node-description-icon-pin:focus-visible{opacity:1!important}.c-menu-node.is-ancestor{color:var(--sidebar-accent)}.c-menu-node.is-ancestor .c-menu-node-description-content,.c-menu-node.is-ancestor .c-menu-node-icon,.c-menu-node.is-ancestor .c-menu-node-description-icon-expand{color:inherit}.c-menu-node.is-active{color:var(--sidebar-accent)}.c-menu-node.is-active .c-menu-node-icon{color:inherit}.c-menu-node.is-active:before{content:\"\";position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:var(--sd-radius-2, 2px);background:var(--sidebar-accent)}.c-menu-node-group{position:relative;margin:0 0 7px 19px;padding:1px 0 1px 16px;border-left:1px solid var(--sidebar-line)}.c-menu-node-group .c-menu-node{min-height:34px;border-radius:var(--sd-radius-6, 6px)}.c-menu-node-group .c-menu-node-description-content{padding:7px 8px;font-weight:var(--sd-font-weight-regular, 400)}.c-menu-node-group .c-menu-node-description{min-height:34px}.c-menu-node-group .c-menu-node-icon{display:none}.c-menu-node-group .c-menu-node.is-active:before{left:-18px}.c-menu-node-group .c-menu-node.is-active .c-menu-node-description-content,.c-menu-node-group .c-menu-node.is-ancestor .c-menu-node-description-content{font-weight:var(--sd-font-weight-medium, 500)}.c-menu-node-group .c-menu-node-group{margin-left:8px;padding-left:7px}.c-menu-node-group .c-menu-node-group .c-menu-node.is-active:before{left:-9px}.c-footer{position:absolute;bottom:0;left:0;width:56px;height:86px;background:var(--sidebar-rail)}a:focus-visible,button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:-2px}@media(pointer:coarse){.c-menu-node,.c-menu-node-group .c-menu-node,.c-menu-node-description,.c-menu-node-group .c-menu-node-description{min-height:44px}}@media(prefers-reduced-motion:reduce){.c-menu-group-icon,.c-menu-node,.c-menu-node *{transition:none!important}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: MatTreeModule }, { kind: "directive", type: i3.MatNestedTreeNode, selector: "mat-nested-tree-node", inputs: ["matNestedTreeNode", "disabled", "tabIndex"], outputs: ["activation", "expandedChange"], exportAs: ["matNestedTreeNode"] }, { kind: "directive", type: i3.MatTreeNodeDef, selector: "[matTreeNodeDef]", inputs: ["matTreeNodeDefWhen", "matTreeNode"] }, { kind: "component", type: i3.MatTree, selector: "mat-tree", exportAs: ["matTree"] }, { kind: "directive", type: i3.MatTreeNodeOutlet, selector: "[matTreeNodeOutlet]" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: LayoutUserComponent$1, selector: "lib-layout-user", inputs: ["isMobileOrTablet", "isMenuLock", "isShowSidebar", "userInfo"], outputs: ["menuClosed", "menuOpened", "toggleMenuLock"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "pipe", type: SdSafeHtmlPipe, name: "sdSafeHtml" }, { kind: "pipe", type: MenuFocusPipe, name: "menuFocus" }, { kind: "pipe", type: HighlightSearchPipe, name: "highLightSearch" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1620
2362
|
}
|
|
1621
2363
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV1Panel, decorators: [{
|
|
1622
2364
|
type: Component,
|
|
@@ -1632,8 +2374,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1632
2374
|
HighlightSearchPipe,
|
|
1633
2375
|
LayoutUserComponent$1,
|
|
1634
2376
|
SdTranslatePipe,
|
|
1635
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n@let _isShowSidebar = isShowSidebar();\n@let _searchText = searchText();\n@let _currentPath = currentPath();\n@let _activeMenuPath = activeMenuPath();\n@let _idMenuGroupActive = idMenuGroupActive();\n@let _pinnedMenuGroup = pinnedMenuGroup();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"wrapper\"\n [style.--sidebar-accent]=\"_sidebar.brandColor || 'var(--sd-primary, #005cbb)'\"\n [style.height]=\"isMobile() ? '100dvh' : '100%'\">\n <div class=\"c-header\">\n <div class=\"c-logo\">\n <a\n href=\"/layout/home\"\n [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\"\n (click)=\"$event.preventDefault(); openHomePage()\">\n @if (logoUrl(); as _logoUrl) {\n <img alt=\"\" [src]=\"_logoUrl\" />\n } @else {\n <sd-icon fontSet=\"material-icons-outlined\" name=\"apps\"></sd-icon>\n }\n </a>\n </div>\n <div class=\"c-title-menu-group\" [class.d-none]=\"!_isShowSidebar\">\n <span>{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n </div>\n </div>\n <div class=\"c-body\">\n <div class=\"c-menu\">\n <div class=\"c-menu-group\">\n @if (_sidebar?.pin?.enabled && _pinnedMenuGroup.children?.length) {\n <button\n type=\"button\"\n [attr.aria-label]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, _pinnedMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, _pinnedMenuGroup)\"\n (click)=\"expandPinnedGroup()\"\n [matTooltip]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color: isPinnedMenuGroupActive()\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor: isPinnedMenuGroupActive()\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n name=\"push_pin\"></sd-icon>\n </button>\n }\n @for (nodeMenuGroup of menus(); track nodeMenuGroup.id) {\n <button\n type=\"button\"\n [attr.aria-label]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, nodeMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, nodeMenuGroup)\"\n (click)=\"expandMenuGroup(nodeMenuGroup)\"\n [matTooltip]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n @if (nodeMenuGroup.iconUrl) {\n <span\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <img width=\"24px\" height=\"24px\" [src]=\"nodeMenuGroup.iconUrl\" [alt]=\"nodeMenuGroup.title\" />\n </span>\n } @else {\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n [name]=\"nodeMenuGroup.icon || 'widgets'\"></sd-icon>\n }\n </button>\n }\n </div>\n <div class=\"c-menu-tree\" [class.d-none]=\"!_isShowSidebar\" [attr.inert]=\"!_isShowSidebar ? '' : null\">\n @if (totalMenuInMenusByGroup() > 10) {\n <div class=\"c-menu-tree-search\">\n @let _searchLabel = 'core.module.layout.sidebar.search' | sdTranslate;\n <div class=\"c-menu-search-field\">\n <sd-icon\n class=\"c-menu-search-icon\"\n fontSet=\"material-icons-outlined\"\n name=\"search\"\n size=\"18px\"\n aria-hidden=\"true\"></sd-icon>\n <input\n #menuSearch\n class=\"c-menu-search-input\"\n type=\"search\"\n autocomplete=\"off\"\n [attr.aria-label]=\"_searchLabel\"\n [placeholder]=\"_searchLabel\"\n data-autoId=\"layout-v1-menu-search\"\n [ngModel]=\"_searchText\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onFilterSearchText($event)\" />\n @if (_searchText) {\n <button\n type=\"button\"\n class=\"c-menu-search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"onClearSearchText(); menuSearch.focus()\">\n <sd-icon fontSet=\"material-icons-outlined\" name=\"close\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"c-menu-tree-container\">\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" [style.backgroundColor]=\"'transparent'\">\n <mat-nested-tree-node *matTreeNodeDef=\"let node; when: !hasChild\">\n <div\n class=\"c-menu-node\"\n [class.is-active]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\"\n [ngStyle]=\"{\n backgroundColor:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <div class=\"c-menu-node-description\" [class.d-none]=\"!_isShowSidebar\">\n <a\n class=\"c-menu-node-description-content\"\n [href]=\"menuNodeHref(node)\"\n [attr.aria-current]=\"(_currentPath | menuFocus: node : _activeMenuPath) ? 'page' : null\"\n (click)=\"onMenuNodeClick($event, node)\"\n [ngStyle]=\"{\n color:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text, #1a1b1f)',\n }\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </a>\n\n <!-- why: n\u00FAt ghim tr\u01B0\u1EDBc \u0111\u00E2y l\u00E0 <sd-icon fontSet=\"material-icons-outlined\" (click)> \u2014 custom element kh\u00F4ng nh\u1EADn\n focus b\u00E0n ph\u00EDm v\u00E0 kh\u00F4ng c\u00F3 t\u00EAn kh\u1EA3 truy c\u1EADp, n\u00EAn kh\u00F4ng ghim \u0111\u01B0\u1EE3c b\u1EB1ng ph\u00EDm.\n \u0110\u1ED5i sang <button type=\"button\"> + aria-pressed, gi\u1ED1ng pattern \u0111\u00E3 d\u00F9ng \u1EDF\n `shared/menu-tree`. -->\n @if (_sidebar?.pin?.enabled) {\n <button\n type=\"button\"\n class=\"c-menu-node-description-icon-pin\"\n [style.opacity]=\"isPinnedNode(node) || isHoveredNode(node) ? '1' : null\"\n [style.color]=\"\n isPinnedNode(node) || isHoveredNode(node) ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)' : null\n \"\n [attr.aria-pressed]=\"isPinnedNode(node)\"\n [attr.aria-label]=\"\n (isPinnedNode(node) ? 'core.module.layout.menu.unpin' : 'core.module.layout.menu.pin')\n | sdTranslate: { title: node.title }\n \"\n (click)=\"onTogglePin($event, node)\">\n <sd-icon fontSet=\"material-icons-outlined\" size=\"18px\" name=\"push_pin\"></sd-icon>\n </button>\n }\n </div>\n </div>\n </mat-nested-tree-node>\n\n <mat-nested-tree-node\n *matTreeNodeDef=\"let node; when: hasChild\"\n [class]=\"{ expanded: treeControl.isExpanded(node), isfocus: _currentPath | menuFocus: node : _activeMenuPath }\">\n <div\n class=\"c-menu-node\"\n [class.is-ancestor]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\">\n <div class=\"d-flex align-items-center\" style=\"gap: 10px; width: 100%\">\n <button\n type=\"button\"\n [class.d-none]=\"!_isShowSidebar\"\n class=\"c-menu-node-description\"\n [attr.aria-expanded]=\"treeControl.isExpanded(node)\"\n (click)=\"onToggleMenuNode(node)\">\n <span class=\"c-menu-node-description-content\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </span>\n <sd-icon\n fontSet=\"material-icons-outlined\"\n aria-hidden=\"true\"\n size=\"18px\"\n class=\"c-menu-node-description-icon-expand\"\n [name]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n </div>\n </div>\n <div class=\"c-menu-node-group\" role=\"group\" [class.d-none]=\"!treeControl.isExpanded(node)\">\n <ng-container matTreeNodeOutlet></ng-container>\n </div>\n </mat-nested-tree-node>\n </mat-tree>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"c-footer\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"isMobile()\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\"\n [isShowSidebar]=\"_isShowSidebar\"\n (toggleMenuLock)=\"toggleMenuLock($event)\">\n </lib-layout-user>\n </div>\n </div>\n}\n", styles: ["::ng-deep .mat-mdc-tooltip-panel:has(.c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140){pointer-events:none}:host{display:block;height:100%}.wrapper{--sidebar-surface: var(--sd-white, #fff);--sidebar-rail: color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 35%, var(--sidebar-surface));--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);position:relative;display:flex;flex-direction:column;width:min(304px,100vw);color:var(--sidebar-ink);background:linear-gradient(to right,var(--sidebar-rail) 56px,var(--sidebar-surface) 56px)}.wrapper,.wrapper *{box-sizing:border-box}.wrapper:before{content:\"\";position:absolute;inset:0 auto 0 55px;width:1px;background:var(--sidebar-line);pointer-events:none}.c-header{flex:0 0 auto;display:grid;grid-template-columns:56px minmax(0,1fr);min-height:42px}.c-logo{grid-column:1;display:grid;place-items:center;height:42px}.c-logo a{display:grid;place-items:center;width:38px;height:40px;border-radius:9px;color:var(--sidebar-muted)}.c-logo img{width:30px;height:30px;object-fit:contain}.c-title-menu-group{grid-column:2;display:flex;align-items:center;min-width:0;padding:10px 14px 12px;color:var(--sidebar-ink);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;overflow-wrap:anywhere}.c-body{flex:1;min-height:0;overflow:hidden}.c-menu{display:flex;height:100%}.c-menu-group{display:flex;flex:0 0 56px;flex-direction:column;align-items:center;gap:10px;width:56px;min-height:0;margin-bottom:86px;padding:5px 0 8px;overflow-y:auto;scrollbar-width:none}.c-menu-group>button{flex:0 0 auto;border-radius:9px}.c-menu-group .c-menu-group-icon{display:flex;align-items:center;justify-content:center;width:38px;height:40px;min-height:40px;border-radius:9px;font-size:var(--sd-font-size-22, 22px)}.c-menu-group .c-menu-group-icon img{width:22px;height:22px;object-fit:contain}.c-menu-tree{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.c-menu-tree-search{flex:0 0 auto;padding:0 14px 12px;border-bottom:1px solid var(--sidebar-line)}.c-menu-search-field{display:flex;align-items:center;gap:8px;height:36px;padding:0 9px;border:1px solid var(--sidebar-line);border-radius:7px;background:var(--sidebar-rail);color:var(--sidebar-muted)}.c-menu-search-field:hover{border-color:color-mix(in srgb,var(--sidebar-muted) 35%,var(--sidebar-surface))}.c-menu-search-field:focus-within{border-color:color-mix(in srgb,var(--sidebar-accent, var(--sd-primary, #005cbb)) 75%,var(--sidebar-surface));background:var(--sidebar-surface)}.c-menu-search-icon{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);pointer-events:none}.c-menu-search-input{flex:1 1 0;width:0;min-width:0;height:100%;margin:0;padding:0;border:0;border-radius:0;outline:none;box-shadow:none;appearance:none;background:transparent;color:var(--sidebar-ink);font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-20, 20px)}.c-menu-search-input:focus,.c-menu-search-input:focus-visible{outline:none;box-shadow:none}.c-menu-search-input::placeholder{color:var(--sidebar-muted);opacity:1}.c-menu-search-input::-webkit-search-decoration,.c-menu-search-input::-webkit-search-cancel-button{appearance:none}.c-menu-search-clear{display:grid;flex:0 0 24px;place-items:center;width:24px;min-width:24px;height:24px;margin:0;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);cursor:pointer}.c-menu-search-clear sd-icon,.c-menu-search-clear mat-icon{width:18px;height:18px;font-size:var(--sd-font-size-18, 18px)}.c-menu-search-clear:hover{background:color-mix(in srgb,var(--sidebar-ink) 7%,transparent);color:var(--sidebar-ink)}.c-menu-search-clear:focus-visible{outline:1px solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.c-menu-tree-container{flex:1;min-height:0;padding:10px 8px 14px;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent;overscroll-behavior:contain}.c-menu-node{position:relative;display:flex;align-items:center;width:100%;min-height:40px;margin:2px 0;padding:0;border-radius:7px;cursor:pointer;color:var(--sidebar-ink);font-size:var(--sd-font-size-13, 13px);line-height:1.4}.c-menu-node-description{display:flex;flex:1;align-items:center;gap:6px;width:100%;min-width:0;min-height:40px;padding:0;border:0;border-radius:inherit;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.c-menu-node-description-content{display:flex;flex:1;align-items:center;align-self:stretch;gap:9px;min-width:0;padding:8px;color:inherit;font:inherit;font-weight:var(--sd-font-weight-medium, 500);text-decoration:none}.c-menu-node-label{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}.c-menu-node-icon{flex:0 0 20px;width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);object-fit:contain;color:var(--sidebar-muted)}.c-menu-node-description-icon-expand,.c-menu-node-description-icon-pin{display:flex;flex:0 0 20px;align-items:center;justify-content:center;width:20px;height:24px;margin-right:6px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);font-size:var(--sd-font-size-18, 18px);cursor:pointer}.c-menu-node-description-icon-pin{opacity:0}.c-menu-node-description-icon-pin:focus-visible{opacity:1!important}.c-menu-node.is-ancestor{color:var(--sidebar-accent)}.c-menu-node.is-ancestor .c-menu-node-description-content,.c-menu-node.is-ancestor .c-menu-node-icon,.c-menu-node.is-ancestor .c-menu-node-description-icon-expand{color:inherit}.c-menu-node.is-active{color:var(--sidebar-accent)}.c-menu-node.is-active .c-menu-node-icon{color:inherit}.c-menu-node.is-active:before{content:\"\";position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:var(--sd-radius-2, 2px);background:var(--sidebar-accent)}.c-menu-node-group{position:relative;margin:0 0 7px 19px;padding:1px 0 1px 16px;border-left:1px solid var(--sidebar-line)}.c-menu-node-group .c-menu-node{min-height:34px;border-radius:var(--sd-radius-6, 6px)}.c-menu-node-group .c-menu-node-description-content{padding:7px 8px;font-weight:var(--sd-font-weight-regular, 400)}.c-menu-node-group .c-menu-node-description{min-height:34px}.c-menu-node-group .c-menu-node-icon{display:none}.c-menu-node-group .c-menu-node.is-active:before{left:-18px}.c-menu-node-group .c-menu-node.is-active .c-menu-node-description-content,.c-menu-node-group .c-menu-node.is-ancestor .c-menu-node-description-content{font-weight:var(--sd-font-weight-medium, 500)}.c-menu-node-group .c-menu-node-group{margin-left:8px;padding-left:7px}.c-menu-node-group .c-menu-node-group .c-menu-node.is-active:before{left:-9px}.c-footer{position:absolute;bottom:0;left:0;width:56px;height:86px;background:var(--sidebar-rail)}a:focus-visible,button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:-2px}@media(pointer:coarse){.c-menu-node,.c-menu-node-group .c-menu-node,.c-menu-node-description,.c-menu-node-group .c-menu-node-description{min-height:44px}}@media(prefers-reduced-motion:reduce){.c-menu-group-icon,.c-menu-node,.c-menu-node *{transition:none!important}}\n"] }]
|
|
1636
|
-
}], ctorParameters: () => [], propDecorators: { isShowSidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "isShowSidebar", required: true }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: true }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }], isMobile: [{ type: i0.Input, args: [{ isSignal: true, alias: "isMobile", required: false }] }], expandSideBar: [{ type: i0.Output, args: ["expandSideBar"] }], popupUserMenuClosed: [{ type: i0.Output, args: ["popupUserMenuClosed"] }], popupUserMenuOpened: [{ type: i0.Output, args: ["popupUserMenuOpened"] }], showSideBar: [{ type: i0.Output, args: ["showSideBar"] }] } });
|
|
2377
|
+
SdLayoutContextSwitcher,
|
|
2378
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n@let _isShowSidebar = isShowSidebar();\n@let _searchText = searchText();\n@let _currentPath = currentPath();\n@let _activeMenuPath = activeMenuPath();\n@let _idMenuGroupActive = idMenuGroupActive();\n@let _pinnedMenuGroup = pinnedMenuGroup();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"wrapper\"\n [style.--sidebar-accent]=\"_sidebar.brandColor || 'var(--sd-primary, #005cbb)'\"\n [style.height]=\"isMobile() ? '100dvh' : '100%'\">\n <div #headerElement class=\"c-header\">\n <div #logoElement class=\"c-logo\">\n <a\n href=\"/layout/home\"\n [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\"\n (click)=\"$event.preventDefault(); openHomePage()\">\n @if (logoUrl(); as _logoUrl) {\n <img alt=\"\" [src]=\"_logoUrl\" />\n } @else {\n <sd-icon fontSet=\"material-icons-outlined\" name=\"apps\"></sd-icon>\n }\n </a>\n </div>\n <!-- Context switcher (D-010): avatar ngay d\u01B0\u1EDBi logo khi thu g\u1ECDn v\u1EC1 rail, d\u00F2ng ph\u1EE5 d\u01B0\u1EDBi ti\u00EAu \u0111\u1EC1 khi m\u1EDF. -->\n @if (_sidebar.context && !_isShowSidebar) {\n <sd-layout-context-switcher class=\"c-rail-context\" appearance=\"rail\" [configuration]=\"_sidebar.context\" [anchor]=\"logoElement\" />\n }\n <div class=\"c-title-menu-group\" [class.d-none]=\"!_isShowSidebar\" [class.c-title-menu-group--context]=\"!!_sidebar.context\">\n <span>{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n @if (_sidebar.context && _isShowSidebar) {\n <sd-layout-context-switcher\n #headerContextSwitcher\n class=\"c-header-context\"\n appearance=\"header\"\n [configuration]=\"_sidebar.context\"\n [anchor]=\"headerElement\" />\n }\n </div>\n </div>\n <div class=\"c-body\">\n <div class=\"c-menu\">\n <div class=\"c-menu-group\">\n @if (_sidebar?.pin?.enabled && _pinnedMenuGroup.children?.length) {\n <button\n type=\"button\"\n [attr.aria-label]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, _pinnedMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, _pinnedMenuGroup)\"\n (click)=\"expandPinnedGroup()\"\n [matTooltip]=\"'core.module.layout.sidebar.pinned' | sdTranslate\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color: isPinnedMenuGroupActive()\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor: isPinnedMenuGroupActive()\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n name=\"push_pin\"></sd-icon>\n </button>\n }\n @for (nodeMenuGroup of menus(); track nodeMenuGroup.id) {\n <button\n type=\"button\"\n [attr.aria-label]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n (mouseenter)=\"onMouseOverMenuGroupNode($event, nodeMenuGroup)\"\n (mouseleave)=\"onMouseLeaveMenuGroupNode($event, nodeMenuGroup)\"\n (click)=\"expandMenuGroup(nodeMenuGroup)\"\n [matTooltip]=\"nodeMenuGroup.tooltipTitle || nodeMenuGroup.title\"\n [matTooltipClass]=\"'c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140'\"\n [matTooltipPosition]=\"'right'\"\n style=\"padding: 0; margin: 0; border: none; background-color: transparent\">\n @if (nodeMenuGroup.iconUrl) {\n <span\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <img width=\"24px\" height=\"24px\" [src]=\"nodeMenuGroup.iconUrl\" [alt]=\"nodeMenuGroup.title\" />\n </span>\n } @else {\n <sd-icon\n fontSet=\"material-icons-outlined\"\n class=\"c-menu-group-icon\"\n size=\"22px\"\n [ngStyle]=\"{\n color:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text-secondary, #44474f)',\n backgroundColor:\n _idMenuGroupActive === nodeMenuGroup?.id\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\"\n [name]=\"nodeMenuGroup.icon || 'widgets'\"></sd-icon>\n }\n </button>\n }\n </div>\n <div class=\"c-menu-tree\" [class.d-none]=\"!_isShowSidebar\" [attr.inert]=\"!_isShowSidebar ? '' : null\">\n @if (totalMenuInMenusByGroup() > 10) {\n <div class=\"c-menu-tree-search\">\n @let _searchLabel = 'core.module.layout.sidebar.search' | sdTranslate;\n <div class=\"c-menu-search-field\">\n <sd-icon\n class=\"c-menu-search-icon\"\n fontSet=\"material-icons-outlined\"\n name=\"search\"\n size=\"18px\"\n aria-hidden=\"true\"></sd-icon>\n <input\n #menuSearch\n class=\"c-menu-search-input\"\n type=\"search\"\n autocomplete=\"off\"\n [attr.aria-label]=\"_searchLabel\"\n [placeholder]=\"_searchLabel\"\n data-autoId=\"layout-v1-menu-search\"\n [ngModel]=\"_searchText\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onFilterSearchText($event)\" />\n @if (_searchText) {\n <button\n type=\"button\"\n class=\"c-menu-search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"onClearSearchText(); menuSearch.focus()\">\n <sd-icon fontSet=\"material-icons-outlined\" name=\"close\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n </button>\n }\n </div>\n </div>\n }\n <div class=\"c-menu-tree-container\">\n <mat-tree [dataSource]=\"dataSource\" [treeControl]=\"treeControl\" [style.backgroundColor]=\"'transparent'\">\n <mat-nested-tree-node *matTreeNodeDef=\"let node; when: !hasChild\">\n <div\n class=\"c-menu-node\"\n [class.is-active]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\"\n [ngStyle]=\"{\n backgroundColor:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandLightColor || 'var(--sd-primary-light, #d7e3ff)'\n : 'transparent',\n }\">\n <div class=\"c-menu-node-description\" [class.d-none]=\"!_isShowSidebar\">\n <a\n class=\"c-menu-node-description-content\"\n [href]=\"menuNodeHref(node)\"\n [attr.aria-current]=\"(_currentPath | menuFocus: node : _activeMenuPath) ? 'page' : null\"\n (click)=\"onMenuNodeClick($event, node)\"\n [ngStyle]=\"{\n color:\n (_currentPath | menuFocus: node : _activeMenuPath)\n ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)'\n : 'var(--sd-text, #1a1b1f)',\n }\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </a>\n\n <!-- why: n\u00FAt ghim tr\u01B0\u1EDBc \u0111\u00E2y l\u00E0 <sd-icon fontSet=\"material-icons-outlined\" (click)> \u2014 custom element kh\u00F4ng nh\u1EADn\n focus b\u00E0n ph\u00EDm v\u00E0 kh\u00F4ng c\u00F3 t\u00EAn kh\u1EA3 truy c\u1EADp, n\u00EAn kh\u00F4ng ghim \u0111\u01B0\u1EE3c b\u1EB1ng ph\u00EDm.\n \u0110\u1ED5i sang <button type=\"button\"> + aria-pressed, gi\u1ED1ng pattern \u0111\u00E3 d\u00F9ng \u1EDF\n `shared/menu-tree`. -->\n @if (_sidebar?.pin?.enabled) {\n <button\n type=\"button\"\n class=\"c-menu-node-description-icon-pin\"\n [style.opacity]=\"isPinnedNode(node) || isHoveredNode(node) ? '1' : null\"\n [style.color]=\"\n isPinnedNode(node) || isHoveredNode(node) ? _sidebar.brandColor || 'var(--sd-primary, #005cbb)' : null\n \"\n [attr.aria-pressed]=\"isPinnedNode(node)\"\n [attr.aria-label]=\"\n (isPinnedNode(node) ? 'core.module.layout.menu.unpin' : 'core.module.layout.menu.pin')\n | sdTranslate: { title: node.title }\n \"\n (click)=\"onTogglePin($event, node)\">\n <sd-icon fontSet=\"material-icons-outlined\" size=\"18px\" name=\"push_pin\"></sd-icon>\n </button>\n }\n </div>\n </div>\n </mat-nested-tree-node>\n\n <mat-nested-tree-node\n *matTreeNodeDef=\"let node; when: hasChild\"\n [class]=\"{ expanded: treeControl.isExpanded(node), isfocus: _currentPath | menuFocus: node : _activeMenuPath }\">\n <div\n class=\"c-menu-node\"\n [class.is-ancestor]=\"_currentPath | menuFocus: node : _activeMenuPath\"\n (mouseenter)=\"onMouseOverMenuNode($event, node)\"\n (mouseleave)=\"onMouseLeaveMenuNode($event, node)\">\n <div class=\"d-flex align-items-center\" style=\"gap: 10px; width: 100%\">\n <button\n type=\"button\"\n [class.d-none]=\"!_isShowSidebar\"\n class=\"c-menu-node-description\"\n [attr.aria-expanded]=\"treeControl.isExpanded(node)\"\n (click)=\"onToggleMenuNode(node)\">\n <span class=\"c-menu-node-description-content\">\n @if (node.iconUrl) {\n <img class=\"c-menu-node-icon\" [src]=\"node.iconUrl\" alt=\"\" />\n } @else if (node.icon) {\n <sd-icon class=\"c-menu-node-icon\" [name]=\"node.icon\" size=\"20px\" fontSet=\"material-icons-outlined\"></sd-icon>\n }\n <span class=\"c-menu-node-label\" [innerHTML]=\"node.title | highLightSearch: _searchText | sdSafeHtml\"></span>\n </span>\n <sd-icon\n fontSet=\"material-icons-outlined\"\n aria-hidden=\"true\"\n size=\"18px\"\n class=\"c-menu-node-description-icon-expand\"\n [name]=\"treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n </div>\n </div>\n <div class=\"c-menu-node-group\" role=\"group\" [class.d-none]=\"!treeControl.isExpanded(node)\">\n <ng-container matTreeNodeOutlet></ng-container>\n </div>\n </mat-nested-tree-node>\n </mat-tree>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"c-footer\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"isMobile()\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\"\n [isShowSidebar]=\"_isShowSidebar\"\n (toggleMenuLock)=\"toggleMenuLock($event)\">\n </lib-layout-user>\n </div>\n </div>\n}\n", styles: ["::ng-deep .mat-mdc-tooltip-panel:has(.c-tooltip-menu-group-7a22ab15-0083-4d4c-9c0c-00a30bc8c140){pointer-events:none}:host{display:block;height:100%}.wrapper{--sidebar-surface: var(--sd-white, #fff);--sidebar-rail: color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 35%, var(--sidebar-surface));--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);position:relative;display:flex;flex-direction:column;width:min(304px,100vw);color:var(--sidebar-ink);background:linear-gradient(to right,var(--sidebar-rail) 56px,var(--sidebar-surface) 56px)}.wrapper,.wrapper *{box-sizing:border-box}.wrapper:before{content:\"\";position:absolute;inset:0 auto 0 55px;width:1px;background:var(--sidebar-line);pointer-events:none}.c-header{flex:0 0 auto;display:grid;grid-template-columns:56px minmax(0,1fr);min-height:42px}.c-logo{grid-column:1;display:grid;place-items:center;height:42px}.c-logo a{display:grid;place-items:center;width:38px;height:40px;border-radius:9px;color:var(--sidebar-muted)}.c-logo img{width:30px;height:30px;object-fit:contain}.c-title-menu-group{grid-column:2;display:flex;align-items:center;min-width:0;padding:10px 14px 12px;color:var(--sidebar-ink);font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;overflow-wrap:anywhere}.c-title-menu-group--context{--sd-layout-context-switcher-popover-width: calc(min(304px, 100vw) - 24px) ;flex-direction:column;align-items:stretch;justify-content:center}.c-header-context{font-weight:var(--sd-font-weight-regular, 400);letter-spacing:normal}.c-rail-context{grid-column:1;grid-row:2}.c-rail-context:not(:empty){margin:4px 0 6px}@media(pointer:coarse){.c-rail-context:not(:empty){margin-top:8px}}.c-body{flex:1;min-height:0;overflow:hidden}.c-menu{display:flex;height:100%}.c-menu-group{display:flex;flex:0 0 56px;flex-direction:column;align-items:center;gap:10px;width:56px;min-height:0;margin-bottom:86px;padding:5px 0 8px;overflow-y:auto;scrollbar-width:none}.c-menu-group>button{flex:0 0 auto;border-radius:9px}.c-menu-group .c-menu-group-icon{display:flex;align-items:center;justify-content:center;width:38px;height:40px;min-height:40px;border-radius:9px;font-size:var(--sd-font-size-22, 22px)}.c-menu-group .c-menu-group-icon img{width:22px;height:22px;object-fit:contain}.c-menu-tree{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.c-menu-tree-search{flex:0 0 auto;padding:0 14px 12px;border-bottom:1px solid var(--sidebar-line)}.c-menu-search-field{display:flex;align-items:center;gap:8px;height:36px;padding:0 9px;border:1px solid var(--sidebar-line);border-radius:7px;background:var(--sidebar-rail);color:var(--sidebar-muted)}.c-menu-search-field:hover{border-color:color-mix(in srgb,var(--sidebar-muted) 35%,var(--sidebar-surface))}.c-menu-search-field:focus-within{border-color:color-mix(in srgb,var(--sidebar-accent, var(--sd-primary, #005cbb)) 75%,var(--sidebar-surface));background:var(--sidebar-surface)}.c-menu-search-icon{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);pointer-events:none}.c-menu-search-input{flex:1 1 0;width:0;min-width:0;height:100%;margin:0;padding:0;border:0;border-radius:0;outline:none;box-shadow:none;appearance:none;background:transparent;color:var(--sidebar-ink);font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-20, 20px)}.c-menu-search-input:focus,.c-menu-search-input:focus-visible{outline:none;box-shadow:none}.c-menu-search-input::placeholder{color:var(--sidebar-muted);opacity:1}.c-menu-search-input::-webkit-search-decoration,.c-menu-search-input::-webkit-search-cancel-button{appearance:none}.c-menu-search-clear{display:grid;flex:0 0 24px;place-items:center;width:24px;min-width:24px;height:24px;margin:0;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);cursor:pointer}.c-menu-search-clear sd-icon,.c-menu-search-clear mat-icon{width:18px;height:18px;font-size:var(--sd-font-size-18, 18px)}.c-menu-search-clear:hover{background:color-mix(in srgb,var(--sidebar-ink) 7%,transparent);color:var(--sidebar-ink)}.c-menu-search-clear:focus-visible{outline:1px solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.c-menu-tree-container{flex:1;min-height:0;padding:10px 8px 14px;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent;overscroll-behavior:contain}.c-menu-node{position:relative;display:flex;align-items:center;width:100%;min-height:40px;margin:2px 0;padding:0;border-radius:7px;cursor:pointer;color:var(--sidebar-ink);font-size:var(--sd-font-size-13, 13px);line-height:1.4}.c-menu-node-description{display:flex;flex:1;align-items:center;gap:6px;width:100%;min-width:0;min-height:40px;padding:0;border:0;border-radius:inherit;color:inherit;background:transparent;font:inherit;text-align:left;cursor:pointer}.c-menu-node-description-content{display:flex;flex:1;align-items:center;align-self:stretch;gap:9px;min-width:0;padding:8px;color:inherit;font:inherit;font-weight:var(--sd-font-weight-medium, 500);text-decoration:none}.c-menu-node-label{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}.c-menu-node-icon{flex:0 0 20px;width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);object-fit:contain;color:var(--sidebar-muted)}.c-menu-node-description-icon-expand,.c-menu-node-description-icon-pin{display:flex;flex:0 0 20px;align-items:center;justify-content:center;width:20px;height:24px;margin-right:6px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sidebar-muted);font-size:var(--sd-font-size-18, 18px);cursor:pointer}.c-menu-node-description-icon-pin{opacity:0}.c-menu-node-description-icon-pin:focus-visible{opacity:1!important}.c-menu-node.is-ancestor{color:var(--sidebar-accent)}.c-menu-node.is-ancestor .c-menu-node-description-content,.c-menu-node.is-ancestor .c-menu-node-icon,.c-menu-node.is-ancestor .c-menu-node-description-icon-expand{color:inherit}.c-menu-node.is-active{color:var(--sidebar-accent)}.c-menu-node.is-active .c-menu-node-icon{color:inherit}.c-menu-node.is-active:before{content:\"\";position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:var(--sd-radius-2, 2px);background:var(--sidebar-accent)}.c-menu-node-group{position:relative;margin:0 0 7px 19px;padding:1px 0 1px 16px;border-left:1px solid var(--sidebar-line)}.c-menu-node-group .c-menu-node{min-height:34px;border-radius:var(--sd-radius-6, 6px)}.c-menu-node-group .c-menu-node-description-content{padding:7px 8px;font-weight:var(--sd-font-weight-regular, 400)}.c-menu-node-group .c-menu-node-description{min-height:34px}.c-menu-node-group .c-menu-node-icon{display:none}.c-menu-node-group .c-menu-node.is-active:before{left:-18px}.c-menu-node-group .c-menu-node.is-active .c-menu-node-description-content,.c-menu-node-group .c-menu-node.is-ancestor .c-menu-node-description-content{font-weight:var(--sd-font-weight-medium, 500)}.c-menu-node-group .c-menu-node-group{margin-left:8px;padding-left:7px}.c-menu-node-group .c-menu-node-group .c-menu-node.is-active:before{left:-9px}.c-footer{position:absolute;bottom:0;left:0;width:56px;height:86px;background:var(--sidebar-rail)}a:focus-visible,button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sidebar-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:-2px}@media(pointer:coarse){.c-menu-node,.c-menu-node-group .c-menu-node,.c-menu-node-description,.c-menu-node-group .c-menu-node-description{min-height:44px}}@media(prefers-reduced-motion:reduce){.c-menu-group-icon,.c-menu-node,.c-menu-node *{transition:none!important}}\n"] }]
|
|
2379
|
+
}], ctorParameters: () => [], propDecorators: { isShowSidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "isShowSidebar", required: true }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: true }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }], isMobile: [{ type: i0.Input, args: [{ isSignal: true, alias: "isMobile", required: false }] }], expandSideBar: [{ type: i0.Output, args: ["expandSideBar"] }], popupUserMenuClosed: [{ type: i0.Output, args: ["popupUserMenuClosed"] }], popupUserMenuOpened: [{ type: i0.Output, args: ["popupUserMenuOpened"] }], showSideBar: [{ type: i0.Output, args: ["showSideBar"] }], headerContextSwitcher: [{ type: i0.ViewChild, args: ['headerContextSwitcher', { isSignal: true }] }] } });
|
|
1637
2380
|
|
|
1638
2381
|
class SdSidebarV1 {
|
|
1639
2382
|
// ==========================================
|
|
@@ -1968,11 +2711,11 @@ class SdSidebarMobileOverlay {
|
|
|
1968
2711
|
return null;
|
|
1969
2712
|
};
|
|
1970
2713
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileOverlay, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1971
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileOverlay, isStandalone: true, selector: "sd-sidebar-mobile-overlay", inputs: { isShowSidebar: { classPropertyName: "isShowSidebar", publicName: "isShowSidebar", isSignal: true, isRequired: false, transformFunction: null }, menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: true, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { showSideBar: "showSideBar", expandSideBar: "expandSideBar", popupUserMenuOpened: "popupUserMenuOpened", popupUserMenuClosed: "popupUserMenuClosed", titleMenuGroupChanged: "titleMenuGroupChanged" }, ngImport: i0, template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"m-backdrop\"\n [class.m-backdrop--visible]=\"isShowSidebar()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"onClose()\"\n (keydown.escape)=\"onClose()\">\n </div>\n\n <div class=\"m-wrapper\" [class.m-wrapper--open]=\"isShowSidebar()\">\n <div class=\"m-header\">\n <div class=\"m-title-group\">\n @if (_sidebar.logoUrl) {\n <img class=\"m-logo\" alt=\"logo\" [src]=\"_sidebar.logoUrl\" />\n }\n <span class=\"m-title\">{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n </div>\n <button class=\"m-close-btn\" (click)=\"onClose()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n\n <div class=\"m-user-section\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"true\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\">\n </lib-layout-user>\n </div>\n\n <div class=\"m-menu-list\">\n @for (group of menus(); track group.id) {\n <div class=\"m-menu-card\">\n <button class=\"m-card-header\" (click)=\"toggleMobileGroup(group.id)\">\n <div class=\"m-card-header-left\">\n @if (group.iconUrl) {\n <img class=\"m-group-icon\" [src]=\"group.iconUrl\" [alt]=\"group.title\" />\n } @else {\n <sd-icon class=\"m-group-icon\" [name]=\"group.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"m-group-title\">{{ group.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(group.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n\n @if (expandedMobileGroups().has(group.id ?? '') && hasChildren(group)) {\n <div class=\"m-card-body\">\n @for (child of getChildren(group); track child.id) {\n @if (hasChildren(child)) {\n <div class=\"m-sub-group\">\n <button class=\"m-sub-group-header\" (click)=\"toggleMobileGroup(child.id)\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'folder'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(child.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n @if (expandedMobileGroups().has(child.id ?? '')) {\n @for (subChild of getChildren(child); track subChild.id) {\n <button class=\"m-menu-item m-menu-item--indented\"\n (click)=\"navigate({ path: getPath(subChild), queryParams: getQueryParams(subChild) })\">\n <div class=\"m-item-left\">\n @if (subChild.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"subChild.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"subChild.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ subChild.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n } @else {\n <button class=\"m-menu-item\" (click)=\"navigate({ path: getPath(child), queryParams: getQueryParams(child) })\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n </div>\n}\n", styles: [":host{display:block;position:fixed;inset:0;z-index:var(--sd-z-dropdown, 1000);pointer-events:none}.m-backdrop{position:absolute;inset:0;background:#0006;opacity:0;pointer-events:none;transition:opacity var(--sd-duration-slow, .3s) ease;cursor:pointer;outline:none}.m-backdrop--visible{opacity:1;pointer-events:auto}.m-wrapper{display:flex;flex-direction:column;position:absolute;inset:0;background-color:var(--sd-sidebar-mobile-bg, #f2f2f6);padding:16px;box-sizing:border-box;overflow-y:auto;pointer-events:none;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));transform:translate(-100%);transition:transform var(--sd-duration-slow, .3s) var(--sd-ease-standard, cubic-bezier(.4, 0, .2, 1))}.m-wrapper--open{transform:translate(0);pointer-events:auto}.m-wrapper .m-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.m-wrapper .m-header .m-title-group{display:flex;align-items:center;gap:12px}.m-wrapper .m-header .m-title-group .m-logo{width:32px;height:32px;object-fit:contain}.m-wrapper .m-header .m-title-group .m-title{font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-header .m-close-btn{background:transparent;border:none;padding:0;color:var(--sd-sidebar-mobile-text, #1f1f1f);display:flex;align-items:center;justify-content:center;cursor:pointer}.m-wrapper .m-header .m-close-btn sd-icon{font-size:var(--sd-font-size-28, 28px);width:28px;height:28px}.m-wrapper .m-user-section{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);padding:12px 16px;margin-bottom:24px;box-shadow:0 1px 2px #00000005;border:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-user-section lib-layout-user{display:block;width:100%}.m-wrapper .m-menu-list{display:flex;flex-direction:column;gap:16px}.m-wrapper .m-menu-card{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);border:1px solid var(--sd-sidebar-mobile-border, #ebebeb);overflow:hidden}.m-wrapper .m-menu-card .m-card-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px;cursor:pointer;-webkit-user-select:none;user-select:none;border:none;background:transparent;-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-header .m-card-header-left{display:flex;align-items:center;gap:16px}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-icon{font-size:var(--sd-font-size-24, 24px);width:24px;height:24px;color:var(--sd-sidebar-mobile-text, #1f1f1f);object-fit:contain}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-menu-card .m-card-header .m-expand-icon{color:var(--sd-sidebar-mobile-text, #1f1f1f);transition:transform var(--sd-duration-base, .2s) ease}.m-wrapper .m-menu-card .m-card-body{display:flex;flex-direction:column;padding-bottom:8px}.m-wrapper .m-menu-card .m-card-body .m-menu-item{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:transparent;transition:background-color var(--sd-duration-base, .2s);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-menu-item:active{background-color:var(--sd-sidebar-mobile-item-active-bg, #f5f5f5)}.m-wrapper .m-menu-card .m-card-body .m-menu-item--indented{padding-left:48px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-nav-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}.m-wrapper .m-menu-card .m-card-body .m-sub-group{border-top:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-menu-card .m-card-body .m-sub-group:first-child{border-top:none}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:var(--sd-sidebar-mobile-hover-bg, #fafafa);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header:active{background-color:var(--sd-sidebar-mobile-pressed-bg, #f0f0f0)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-expand-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "component", type: LayoutUserComponent, selector: "lib-layout-user", inputs: ["isMobileOrTablet", "isMenuLock", "isShowSidebar", "userInfo"], outputs: ["menuClosed", "menuOpened", "toggleMenuLock"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
2714
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileOverlay, isStandalone: true, selector: "sd-sidebar-mobile-overlay", inputs: { isShowSidebar: { classPropertyName: "isShowSidebar", publicName: "isShowSidebar", isSignal: true, isRequired: false, transformFunction: null }, menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: true, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { showSideBar: "showSideBar", expandSideBar: "expandSideBar", popupUserMenuOpened: "popupUserMenuOpened", popupUserMenuClosed: "popupUserMenuClosed", titleMenuGroupChanged: "titleMenuGroupChanged" }, ngImport: i0, template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"m-backdrop\"\n [class.m-backdrop--visible]=\"isShowSidebar()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"onClose()\"\n (keydown.escape)=\"onClose()\">\n </div>\n\n <div class=\"m-wrapper\" [class.m-wrapper--open]=\"isShowSidebar()\">\n <div #headerElement class=\"m-header\" [class.m-header--context]=\"!!_sidebar.context\">\n <div class=\"m-title-group\">\n @if (_sidebar.logoUrl) {\n <img class=\"m-logo\" alt=\"logo\" [src]=\"_sidebar.logoUrl\" />\n }\n <span class=\"m-title\">{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n </div>\n <button class=\"m-close-btn\" (click)=\"onClose()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n <!-- Context switcher (D-010): h\u00E0ng ri\u00EAng d\u01B0\u1EDBi ti\u00EAu \u0111\u1EC1, m\u1EDF bottom sheet. -->\n @if (_sidebar.context) {\n <sd-layout-context-switcher class=\"m-header-context\" appearance=\"sheet\" [configuration]=\"_sidebar.context\" [anchor]=\"headerElement\" />\n }\n </div>\n\n <div class=\"m-user-section\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"true\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\">\n </lib-layout-user>\n </div>\n\n <div class=\"m-menu-list\">\n @for (group of menus(); track group.id) {\n <div class=\"m-menu-card\">\n <button class=\"m-card-header\" (click)=\"toggleMobileGroup(group.id)\">\n <div class=\"m-card-header-left\">\n @if (group.iconUrl) {\n <img class=\"m-group-icon\" [src]=\"group.iconUrl\" [alt]=\"group.title\" />\n } @else {\n <sd-icon class=\"m-group-icon\" [name]=\"group.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"m-group-title\">{{ group.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(group.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n\n @if (expandedMobileGroups().has(group.id ?? '') && hasChildren(group)) {\n <div class=\"m-card-body\">\n @for (child of getChildren(group); track child.id) {\n @if (hasChildren(child)) {\n <div class=\"m-sub-group\">\n <button class=\"m-sub-group-header\" (click)=\"toggleMobileGroup(child.id)\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'folder'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(child.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n @if (expandedMobileGroups().has(child.id ?? '')) {\n @for (subChild of getChildren(child); track subChild.id) {\n <button class=\"m-menu-item m-menu-item--indented\"\n (click)=\"navigate({ path: getPath(subChild), queryParams: getQueryParams(subChild) })\">\n <div class=\"m-item-left\">\n @if (subChild.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"subChild.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"subChild.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ subChild.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n } @else {\n <button class=\"m-menu-item\" (click)=\"navigate({ path: getPath(child), queryParams: getQueryParams(child) })\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n </div>\n}\n", styles: [":host{display:block;position:fixed;inset:0;z-index:var(--sd-z-dropdown, 1000);pointer-events:none}.m-backdrop{position:absolute;inset:0;background:#0006;opacity:0;pointer-events:none;transition:opacity var(--sd-duration-slow, .3s) ease;cursor:pointer;outline:none}.m-backdrop--visible{opacity:1;pointer-events:auto}.m-wrapper{display:flex;flex-direction:column;position:absolute;inset:0;background-color:var(--sd-sidebar-mobile-bg, #f2f2f6);padding:16px;box-sizing:border-box;overflow-y:auto;pointer-events:none;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));transform:translate(-100%);transition:transform var(--sd-duration-slow, .3s) var(--sd-ease-standard, cubic-bezier(.4, 0, .2, 1))}.m-wrapper--open{transform:translate(0);pointer-events:auto}.m-wrapper .m-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.m-wrapper .m-header .m-title-group{display:flex;align-items:center;gap:12px}.m-wrapper .m-header .m-title-group .m-logo{width:32px;height:32px;object-fit:contain}.m-wrapper .m-header .m-title-group .m-title{font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-header.m-header--context{flex-wrap:wrap}.m-wrapper .m-header .m-header-context{flex:0 0 100%;min-width:0}.m-wrapper .m-header .m-header-context:not(:empty){margin-top:12px}.m-wrapper .m-header .m-close-btn{background:transparent;border:none;padding:0;color:var(--sd-sidebar-mobile-text, #1f1f1f);display:flex;align-items:center;justify-content:center;cursor:pointer}.m-wrapper .m-header .m-close-btn sd-icon{font-size:var(--sd-font-size-28, 28px);width:28px;height:28px}.m-wrapper .m-user-section{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);padding:12px 16px;margin-bottom:24px;box-shadow:0 1px 2px #00000005;border:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-user-section lib-layout-user{display:block;width:100%}.m-wrapper .m-menu-list{display:flex;flex-direction:column;gap:16px}.m-wrapper .m-menu-card{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);border:1px solid var(--sd-sidebar-mobile-border, #ebebeb);overflow:hidden}.m-wrapper .m-menu-card .m-card-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px;cursor:pointer;-webkit-user-select:none;user-select:none;border:none;background:transparent;-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-header .m-card-header-left{display:flex;align-items:center;gap:16px}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-icon{font-size:var(--sd-font-size-24, 24px);width:24px;height:24px;color:var(--sd-sidebar-mobile-text, #1f1f1f);object-fit:contain}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-menu-card .m-card-header .m-expand-icon{color:var(--sd-sidebar-mobile-text, #1f1f1f);transition:transform var(--sd-duration-base, .2s) ease}.m-wrapper .m-menu-card .m-card-body{display:flex;flex-direction:column;padding-bottom:8px}.m-wrapper .m-menu-card .m-card-body .m-menu-item{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:transparent;transition:background-color var(--sd-duration-base, .2s);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-menu-item:active{background-color:var(--sd-sidebar-mobile-item-active-bg, #f5f5f5)}.m-wrapper .m-menu-card .m-card-body .m-menu-item--indented{padding-left:48px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-nav-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}.m-wrapper .m-menu-card .m-card-body .m-sub-group{border-top:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-menu-card .m-card-body .m-sub-group:first-child{border-top:none}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:var(--sd-sidebar-mobile-hover-bg, #fafafa);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header:active{background-color:var(--sd-sidebar-mobile-pressed-bg, #f0f0f0)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-expand-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "component", type: LayoutUserComponent, selector: "lib-layout-user", inputs: ["isMobileOrTablet", "isMenuLock", "isShowSidebar", "userInfo"], outputs: ["menuClosed", "menuOpened", "toggleMenuLock"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1972
2715
|
}
|
|
1973
2716
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileOverlay, decorators: [{
|
|
1974
2717
|
type: Component,
|
|
1975
|
-
args: [{ changeDetection: ChangeDetectionStrategy.Eager, selector: 'sd-sidebar-mobile-overlay', standalone: true, imports: [SdIcon, CommonModule, RouterModule, LayoutUserComponent], template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"m-backdrop\"\n [class.m-backdrop--visible]=\"isShowSidebar()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"onClose()\"\n (keydown.escape)=\"onClose()\">\n </div>\n\n <div class=\"m-wrapper\" [class.m-wrapper--open]=\"isShowSidebar()\">\n <div class=\"m-header\">\n <div class=\"m-title-group\">\n @if (_sidebar.logoUrl) {\n <img class=\"m-logo\" alt=\"logo\" [src]=\"_sidebar.logoUrl\" />\n }\n <span class=\"m-title\">{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n </div>\n <button class=\"m-close-btn\" (click)=\"onClose()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n\n <div class=\"m-user-section\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"true\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\">\n </lib-layout-user>\n </div>\n\n <div class=\"m-menu-list\">\n @for (group of menus(); track group.id) {\n <div class=\"m-menu-card\">\n <button class=\"m-card-header\" (click)=\"toggleMobileGroup(group.id)\">\n <div class=\"m-card-header-left\">\n @if (group.iconUrl) {\n <img class=\"m-group-icon\" [src]=\"group.iconUrl\" [alt]=\"group.title\" />\n } @else {\n <sd-icon class=\"m-group-icon\" [name]=\"group.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"m-group-title\">{{ group.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(group.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n\n @if (expandedMobileGroups().has(group.id ?? '') && hasChildren(group)) {\n <div class=\"m-card-body\">\n @for (child of getChildren(group); track child.id) {\n @if (hasChildren(child)) {\n <div class=\"m-sub-group\">\n <button class=\"m-sub-group-header\" (click)=\"toggleMobileGroup(child.id)\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'folder'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(child.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n @if (expandedMobileGroups().has(child.id ?? '')) {\n @for (subChild of getChildren(child); track subChild.id) {\n <button class=\"m-menu-item m-menu-item--indented\"\n (click)=\"navigate({ path: getPath(subChild), queryParams: getQueryParams(subChild) })\">\n <div class=\"m-item-left\">\n @if (subChild.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"subChild.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"subChild.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ subChild.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n } @else {\n <button class=\"m-menu-item\" (click)=\"navigate({ path: getPath(child), queryParams: getQueryParams(child) })\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n </div>\n}\n", styles: [":host{display:block;position:fixed;inset:0;z-index:var(--sd-z-dropdown, 1000);pointer-events:none}.m-backdrop{position:absolute;inset:0;background:#0006;opacity:0;pointer-events:none;transition:opacity var(--sd-duration-slow, .3s) ease;cursor:pointer;outline:none}.m-backdrop--visible{opacity:1;pointer-events:auto}.m-wrapper{display:flex;flex-direction:column;position:absolute;inset:0;background-color:var(--sd-sidebar-mobile-bg, #f2f2f6);padding:16px;box-sizing:border-box;overflow-y:auto;pointer-events:none;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));transform:translate(-100%);transition:transform var(--sd-duration-slow, .3s) var(--sd-ease-standard, cubic-bezier(.4, 0, .2, 1))}.m-wrapper--open{transform:translate(0);pointer-events:auto}.m-wrapper .m-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.m-wrapper .m-header .m-title-group{display:flex;align-items:center;gap:12px}.m-wrapper .m-header .m-title-group .m-logo{width:32px;height:32px;object-fit:contain}.m-wrapper .m-header .m-title-group .m-title{font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-header .m-close-btn{background:transparent;border:none;padding:0;color:var(--sd-sidebar-mobile-text, #1f1f1f);display:flex;align-items:center;justify-content:center;cursor:pointer}.m-wrapper .m-header .m-close-btn sd-icon{font-size:var(--sd-font-size-28, 28px);width:28px;height:28px}.m-wrapper .m-user-section{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);padding:12px 16px;margin-bottom:24px;box-shadow:0 1px 2px #00000005;border:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-user-section lib-layout-user{display:block;width:100%}.m-wrapper .m-menu-list{display:flex;flex-direction:column;gap:16px}.m-wrapper .m-menu-card{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);border:1px solid var(--sd-sidebar-mobile-border, #ebebeb);overflow:hidden}.m-wrapper .m-menu-card .m-card-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px;cursor:pointer;-webkit-user-select:none;user-select:none;border:none;background:transparent;-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-header .m-card-header-left{display:flex;align-items:center;gap:16px}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-icon{font-size:var(--sd-font-size-24, 24px);width:24px;height:24px;color:var(--sd-sidebar-mobile-text, #1f1f1f);object-fit:contain}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-menu-card .m-card-header .m-expand-icon{color:var(--sd-sidebar-mobile-text, #1f1f1f);transition:transform var(--sd-duration-base, .2s) ease}.m-wrapper .m-menu-card .m-card-body{display:flex;flex-direction:column;padding-bottom:8px}.m-wrapper .m-menu-card .m-card-body .m-menu-item{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:transparent;transition:background-color var(--sd-duration-base, .2s);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-menu-item:active{background-color:var(--sd-sidebar-mobile-item-active-bg, #f5f5f5)}.m-wrapper .m-menu-card .m-card-body .m-menu-item--indented{padding-left:48px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-nav-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}.m-wrapper .m-menu-card .m-card-body .m-sub-group{border-top:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-menu-card .m-card-body .m-sub-group:first-child{border-top:none}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:var(--sd-sidebar-mobile-hover-bg, #fafafa);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header:active{background-color:var(--sd-sidebar-mobile-pressed-bg, #f0f0f0)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-expand-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}\n"] }]
|
|
2718
|
+
args: [{ changeDetection: ChangeDetectionStrategy.Eager, selector: 'sd-sidebar-mobile-overlay', standalone: true, imports: [SdIcon, CommonModule, RouterModule, LayoutUserComponent, SdLayoutContextSwitcher], template: "@let _userInfo = userInfo();\n@let _sidebar = sidebar();\n\n@if (_userInfo && _sidebar) {\n <div\n class=\"m-backdrop\"\n [class.m-backdrop--visible]=\"isShowSidebar()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"onClose()\"\n (keydown.escape)=\"onClose()\">\n </div>\n\n <div class=\"m-wrapper\" [class.m-wrapper--open]=\"isShowSidebar()\">\n <div #headerElement class=\"m-header\" [class.m-header--context]=\"!!_sidebar.context\">\n <div class=\"m-title-group\">\n @if (_sidebar.logoUrl) {\n <img class=\"m-logo\" alt=\"logo\" [src]=\"_sidebar.logoUrl\" />\n }\n <span class=\"m-title\">{{ titleMenuGroup() || _sidebar.defaultTitle || 'Back Office' }}</span>\n </div>\n <button class=\"m-close-btn\" (click)=\"onClose()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n <!-- Context switcher (D-010): h\u00E0ng ri\u00EAng d\u01B0\u1EDBi ti\u00EAu \u0111\u1EC1, m\u1EDF bottom sheet. -->\n @if (_sidebar.context) {\n <sd-layout-context-switcher class=\"m-header-context\" appearance=\"sheet\" [configuration]=\"_sidebar.context\" [anchor]=\"headerElement\" />\n }\n </div>\n\n <div class=\"m-user-section\">\n <lib-layout-user\n [userInfo]=\"_userInfo\"\n [isMobileOrTablet]=\"true\"\n (menuOpened)=\"onUserMenuOpened()\"\n (menuClosed)=\"onUserMenuClosed()\">\n </lib-layout-user>\n </div>\n\n <div class=\"m-menu-list\">\n @for (group of menus(); track group.id) {\n <div class=\"m-menu-card\">\n <button class=\"m-card-header\" (click)=\"toggleMobileGroup(group.id)\">\n <div class=\"m-card-header-left\">\n @if (group.iconUrl) {\n <img class=\"m-group-icon\" [src]=\"group.iconUrl\" [alt]=\"group.title\" />\n } @else {\n <sd-icon class=\"m-group-icon\" [name]=\"group.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"m-group-title\">{{ group.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(group.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n\n @if (expandedMobileGroups().has(group.id ?? '') && hasChildren(group)) {\n <div class=\"m-card-body\">\n @for (child of getChildren(group); track child.id) {\n @if (hasChildren(child)) {\n <div class=\"m-sub-group\">\n <button class=\"m-sub-group-header\" (click)=\"toggleMobileGroup(child.id)\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'folder'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-expand-icon\" [name]=\"expandedMobileGroups().has(child.id ?? '') ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n </button>\n @if (expandedMobileGroups().has(child.id ?? '')) {\n @for (subChild of getChildren(child); track subChild.id) {\n <button class=\"m-menu-item m-menu-item--indented\"\n (click)=\"navigate({ path: getPath(subChild), queryParams: getQueryParams(subChild) })\">\n <div class=\"m-item-left\">\n @if (subChild.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"subChild.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"subChild.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ subChild.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n } @else {\n <button class=\"m-menu-item\" (click)=\"navigate({ path: getPath(child), queryParams: getQueryParams(child) })\">\n <div class=\"m-item-left\">\n @if (child.iconUrl) {\n <img class=\"m-item-icon-img\" [src]=\"child.iconUrl\" alt=\"icon\" />\n } @else {\n <sd-icon class=\"m-item-icon\" [name]=\"child.icon || 'insert_drive_file'\"></sd-icon>\n }\n <span class=\"m-item-title\">{{ child.title }}</span>\n </div>\n <sd-icon class=\"m-nav-icon\" name=\"chevron_right\"></sd-icon>\n </button>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n </div>\n}\n", styles: [":host{display:block;position:fixed;inset:0;z-index:var(--sd-z-dropdown, 1000);pointer-events:none}.m-backdrop{position:absolute;inset:0;background:#0006;opacity:0;pointer-events:none;transition:opacity var(--sd-duration-slow, .3s) ease;cursor:pointer;outline:none}.m-backdrop--visible{opacity:1;pointer-events:auto}.m-wrapper{display:flex;flex-direction:column;position:absolute;inset:0;background-color:var(--sd-sidebar-mobile-bg, #f2f2f6);padding:16px;box-sizing:border-box;overflow-y:auto;pointer-events:none;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));transform:translate(-100%);transition:transform var(--sd-duration-slow, .3s) var(--sd-ease-standard, cubic-bezier(.4, 0, .2, 1))}.m-wrapper--open{transform:translate(0);pointer-events:auto}.m-wrapper .m-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.m-wrapper .m-header .m-title-group{display:flex;align-items:center;gap:12px}.m-wrapper .m-header .m-title-group .m-logo{width:32px;height:32px;object-fit:contain}.m-wrapper .m-header .m-title-group .m-title{font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-header.m-header--context{flex-wrap:wrap}.m-wrapper .m-header .m-header-context{flex:0 0 100%;min-width:0}.m-wrapper .m-header .m-header-context:not(:empty){margin-top:12px}.m-wrapper .m-header .m-close-btn{background:transparent;border:none;padding:0;color:var(--sd-sidebar-mobile-text, #1f1f1f);display:flex;align-items:center;justify-content:center;cursor:pointer}.m-wrapper .m-header .m-close-btn sd-icon{font-size:var(--sd-font-size-28, 28px);width:28px;height:28px}.m-wrapper .m-user-section{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);padding:12px 16px;margin-bottom:24px;box-shadow:0 1px 2px #00000005;border:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-user-section lib-layout-user{display:block;width:100%}.m-wrapper .m-menu-list{display:flex;flex-direction:column;gap:16px}.m-wrapper .m-menu-card{background-color:var(--sd-sidebar-mobile-card-bg, #ffffff);border-radius:var(--sd-radius-12, 12px);border:1px solid var(--sd-sidebar-mobile-border, #ebebeb);overflow:hidden}.m-wrapper .m-menu-card .m-card-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px;cursor:pointer;-webkit-user-select:none;user-select:none;border:none;background:transparent;-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-header .m-card-header-left{display:flex;align-items:center;gap:16px}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-icon{font-size:var(--sd-font-size-24, 24px);width:24px;height:24px;color:var(--sd-sidebar-mobile-text, #1f1f1f);object-fit:contain}.m-wrapper .m-menu-card .m-card-header .m-card-header-left .m-group-title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-sidebar-mobile-text, #1f1f1f)}.m-wrapper .m-menu-card .m-card-header .m-expand-icon{color:var(--sd-sidebar-mobile-text, #1f1f1f);transition:transform var(--sd-duration-base, .2s) ease}.m-wrapper .m-menu-card .m-card-body{display:flex;flex-direction:column;padding-bottom:8px}.m-wrapper .m-menu-card .m-card-body .m-menu-item{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:transparent;transition:background-color var(--sd-duration-base, .2s);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-menu-item:active{background-color:var(--sd-sidebar-mobile-item-active-bg, #f5f5f5)}.m-wrapper .m-menu-card .m-card-body .m-menu-item--indented{padding-left:48px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-menu-item .m-nav-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}.m-wrapper .m-menu-card .m-card-body .m-sub-group{border-top:1px solid var(--sd-sidebar-mobile-border, #ebebeb)}.m-wrapper .m-menu-card .m-card-body .m-sub-group:first-child{border-top:none}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header{display:flex;justify-content:space-between;align-items:center;width:100%;padding:12px 16px 12px 24px;cursor:pointer;border:none;background:var(--sd-sidebar-mobile-hover-bg, #fafafa);-webkit-tap-highlight-color:transparent}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header:active{background-color:var(--sd-sidebar-mobile-pressed-bg, #f0f0f0)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left{display:flex;align-items:center;gap:12px}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon{font-size:var(--sd-font-size-20, 20px);width:20px;height:20px;color:var(--sd-sidebar-mobile-icon, #8c8c8c)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-icon-img{width:20px;height:20px;object-fit:contain;opacity:.7}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-item-left .m-item-title{font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-sidebar-mobile-text-secondary, #333333)}.m-wrapper .m-menu-card .m-card-body .m-sub-group .m-sub-group-header .m-expand-icon{color:var(--sd-sidebar-mobile-icon, #8c8c8c);font-size:var(--sd-font-size-20, 20px);width:20px;height:20px}\n"] }]
|
|
1976
2719
|
}], ctorParameters: () => [], propDecorators: { isShowSidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "isShowSidebar", required: false }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: true }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }], showSideBar: [{ type: i0.Output, args: ["showSideBar"] }], expandSideBar: [{ type: i0.Output, args: ["expandSideBar"] }], popupUserMenuOpened: [{ type: i0.Output, args: ["popupUserMenuOpened"] }], popupUserMenuClosed: [{ type: i0.Output, args: ["popupUserMenuClosed"] }], titleMenuGroupChanged: [{ type: i0.Output, args: ["titleMenuGroupChanged"] }] } });
|
|
1977
2720
|
|
|
1978
2721
|
class SdSidebarMobileV1 {
|
|
@@ -2153,11 +2896,11 @@ class SdLayoutSearchFieldComponent {
|
|
|
2153
2896
|
...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
2154
2897
|
sdChange = output();
|
|
2155
2898
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutSearchFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2156
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.5", type: SdLayoutSearchFieldComponent, isStandalone: true, selector: "sd-layout-search-field", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: true, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: true, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdChange: "sdChange" }, ngImport: i0, template: "<div\n data-layout-search\n class=\"sd-layout-search-field d-flex align-items-center gap-8\"\n [class.sd-layout-search-field--soft-pill]=\"appearance() === 'pill'\"\n [class.sd-layout-search-field--compact]=\"appearance() === 'compact'\">\n <sd-icon class=\"sd-layout-search-field__icon\" name=\"search\"></sd-icon>\n <sd-input\n class=\"sd-layout-search-field__control\"\n size=\"sm\"\n hideInlineError\n [placeholder]=\"placeholder()\"\n [autoId]=\"autoId()\"\n [model]=\"model()\"\n (sdChange)=\"sdChange.emit($event)\">\n </sd-input>\n</div>\n", styles: [":host{display:block;min-width:0}.sd-layout-search-field{min-height:38px;padding:0 12px;border:0;border-radius:9999px;outline:1px solid transparent;outline-offset:1px;background:var(--sd-black100, var(--sd-surface-muted));color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field:focus-within{outline-color:var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-search-field__icon{flex:0 0 auto;color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field__control{flex:1;min-width:0;--sd-border: transparent;--mdc-outlined-text-field-outline-color: transparent;--mdc-outlined-text-field-hover-outline-color: transparent;--mdc-outlined-text-field-focus-outline-color: transparent;--mdc-outlined-text-field-input-text-placeholder-color: var(--sd-black400, var(--sd-text-muted));--mdc-outlined-text-field-container-shape: 0px}:host ::ng-deep .sd-layout-search-field__control input:focus-visible{outline:0}.sd-layout-search-field--compact{min-height:36px;padding:0 9px;border:1px solid color-mix(in srgb,var(--sd-border, #c4c6d0) 45%,var(--sd-white, #fff));border-radius:7px;background:color-mix(in srgb,var(--sd-surface-muted, #e7e8ed) 35%,var(--sd-white, #fff));color:var(--sd-text-secondary, #6b7280);outline:0;--mat-form-field-container-height: 34px;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-container-text-size: 13px}.sd-layout-search-field--compact:focus-within{border-color:color-mix(in srgb,var(--sd-primary, #005cbb) 75%,var(--sd-white, #fff))}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2899
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.5", type: SdLayoutSearchFieldComponent, isStandalone: true, selector: "sd-layout-search-field", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: true, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: true, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdChange: "sdChange" }, ngImport: i0, template: "<div\n data-layout-search\n class=\"sd-layout-search-field d-flex align-items-center gap-8\"\n [class.sd-layout-search-field--soft-pill]=\"appearance() === 'pill'\"\n [class.sd-layout-search-field--compact]=\"appearance() === 'compact'\">\n <sd-icon class=\"sd-layout-search-field__icon\" name=\"search\"></sd-icon>\n <sd-input\n class=\"sd-layout-search-field__control\"\n size=\"sm\"\n hideInlineError\n [placeholder]=\"placeholder()\"\n [autoId]=\"autoId()\"\n [model]=\"model()\"\n (sdChange)=\"sdChange.emit($event)\">\n </sd-input>\n</div>\n", styles: [":host{display:block;min-width:0}.sd-layout-search-field{min-height:38px;padding:0 12px;border:0;border-radius:9999px;outline:1px solid transparent;outline-offset:1px;background:var(--sd-black100, var(--sd-surface-muted));color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field:focus-within{outline-color:var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-search-field__icon{flex:0 0 auto;color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field__control{flex:1;min-width:0;--sd-border: transparent;--mdc-outlined-text-field-outline-color: transparent;--mdc-outlined-text-field-hover-outline-color: transparent;--mdc-outlined-text-field-focus-outline-color: transparent;--mat-form-field-outlined-outline-color: transparent;--mat-form-field-outlined-hover-outline-color: transparent;--mat-form-field-outlined-focus-outline-color: transparent;--mdc-outlined-text-field-input-text-placeholder-color: var(--sd-black400, var(--sd-text-muted));--mdc-outlined-text-field-container-shape: 0px;--mat-form-field-outlined-input-text-placeholder-color: var(--sd-black400, var(--sd-text-muted));--mat-form-field-outlined-container-shape: 0px}:host ::ng-deep .sd-layout-search-field__control input:focus-visible{outline:0}.sd-layout-search-field--compact{min-height:36px;padding:0 9px;border:1px solid color-mix(in srgb,var(--sd-border, #c4c6d0) 45%,var(--sd-white, #fff));border-radius:7px;background:color-mix(in srgb,var(--sd-surface-muted, #e7e8ed) 35%,var(--sd-white, #fff));color:var(--sd-text-secondary, #6b7280);outline:0;--mat-form-field-container-height: 34px;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-container-text-size: 13px}.sd-layout-search-field--compact:focus-within{border-color:color-mix(in srgb,var(--sd-primary, #005cbb) 75%,var(--sd-white, #fff))}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2157
2900
|
}
|
|
2158
2901
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutSearchFieldComponent, decorators: [{
|
|
2159
2902
|
type: Component,
|
|
2160
|
-
args: [{ selector: 'sd-layout-search-field', standalone: true, imports: [SdIcon, SdInput], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n data-layout-search\n class=\"sd-layout-search-field d-flex align-items-center gap-8\"\n [class.sd-layout-search-field--soft-pill]=\"appearance() === 'pill'\"\n [class.sd-layout-search-field--compact]=\"appearance() === 'compact'\">\n <sd-icon class=\"sd-layout-search-field__icon\" name=\"search\"></sd-icon>\n <sd-input\n class=\"sd-layout-search-field__control\"\n size=\"sm\"\n hideInlineError\n [placeholder]=\"placeholder()\"\n [autoId]=\"autoId()\"\n [model]=\"model()\"\n (sdChange)=\"sdChange.emit($event)\">\n </sd-input>\n</div>\n", styles: [":host{display:block;min-width:0}.sd-layout-search-field{min-height:38px;padding:0 12px;border:0;border-radius:9999px;outline:1px solid transparent;outline-offset:1px;background:var(--sd-black100, var(--sd-surface-muted));color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field:focus-within{outline-color:var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-search-field__icon{flex:0 0 auto;color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field__control{flex:1;min-width:0;--sd-border: transparent;--mdc-outlined-text-field-outline-color: transparent;--mdc-outlined-text-field-hover-outline-color: transparent;--mdc-outlined-text-field-focus-outline-color: transparent;--mdc-outlined-text-field-input-text-placeholder-color: var(--sd-black400, var(--sd-text-muted));--mdc-outlined-text-field-container-shape: 0px}:host ::ng-deep .sd-layout-search-field__control input:focus-visible{outline:0}.sd-layout-search-field--compact{min-height:36px;padding:0 9px;border:1px solid color-mix(in srgb,var(--sd-border, #c4c6d0) 45%,var(--sd-white, #fff));border-radius:7px;background:color-mix(in srgb,var(--sd-surface-muted, #e7e8ed) 35%,var(--sd-white, #fff));color:var(--sd-text-secondary, #6b7280);outline:0;--mat-form-field-container-height: 34px;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-container-text-size: 13px}.sd-layout-search-field--compact:focus-within{border-color:color-mix(in srgb,var(--sd-primary, #005cbb) 75%,var(--sd-white, #fff))}\n"] }]
|
|
2903
|
+
args: [{ selector: 'sd-layout-search-field', standalone: true, imports: [SdIcon, SdInput], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n data-layout-search\n class=\"sd-layout-search-field d-flex align-items-center gap-8\"\n [class.sd-layout-search-field--soft-pill]=\"appearance() === 'pill'\"\n [class.sd-layout-search-field--compact]=\"appearance() === 'compact'\">\n <sd-icon class=\"sd-layout-search-field__icon\" name=\"search\"></sd-icon>\n <sd-input\n class=\"sd-layout-search-field__control\"\n size=\"sm\"\n hideInlineError\n [placeholder]=\"placeholder()\"\n [autoId]=\"autoId()\"\n [model]=\"model()\"\n (sdChange)=\"sdChange.emit($event)\">\n </sd-input>\n</div>\n", styles: [":host{display:block;min-width:0}.sd-layout-search-field{min-height:38px;padding:0 12px;border:0;border-radius:9999px;outline:1px solid transparent;outline-offset:1px;background:var(--sd-black100, var(--sd-surface-muted));color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field:focus-within{outline-color:var(--sd-focus-ring-color, var(--sd-primary))}.sd-layout-search-field__icon{flex:0 0 auto;color:var(--sd-black400, var(--sd-text-muted))}.sd-layout-search-field__control{flex:1;min-width:0;--sd-border: transparent;--mdc-outlined-text-field-outline-color: transparent;--mdc-outlined-text-field-hover-outline-color: transparent;--mdc-outlined-text-field-focus-outline-color: transparent;--mat-form-field-outlined-outline-color: transparent;--mat-form-field-outlined-hover-outline-color: transparent;--mat-form-field-outlined-focus-outline-color: transparent;--mdc-outlined-text-field-input-text-placeholder-color: var(--sd-black400, var(--sd-text-muted));--mdc-outlined-text-field-container-shape: 0px;--mat-form-field-outlined-input-text-placeholder-color: var(--sd-black400, var(--sd-text-muted));--mat-form-field-outlined-container-shape: 0px}:host ::ng-deep .sd-layout-search-field__control input:focus-visible{outline:0}.sd-layout-search-field--compact{min-height:36px;padding:0 9px;border:1px solid color-mix(in srgb,var(--sd-border, #c4c6d0) 45%,var(--sd-white, #fff));border-radius:7px;background:color-mix(in srgb,var(--sd-surface-muted, #e7e8ed) 35%,var(--sd-white, #fff));color:var(--sd-text-secondary, #6b7280);outline:0;--mat-form-field-container-height: 34px;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-container-text-size: 13px}.sd-layout-search-field--compact:focus-within{border-color:color-mix(in srgb,var(--sd-primary, #005cbb) 75%,var(--sd-white, #fff))}\n"] }]
|
|
2161
2904
|
}], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: true }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: true }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }] } });
|
|
2162
2905
|
|
|
2163
2906
|
class SdSidebarV2 {
|
|
@@ -2286,13 +3029,20 @@ class SdSidebarV2 {
|
|
|
2286
3029
|
this.#navigationState.patchVersionState(2, { locked: false });
|
|
2287
3030
|
}
|
|
2288
3031
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV2, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2289
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV2, isStandalone: true, selector: "sd-sidebar-v2", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown.escape": "closeFromEscape()" } }, ngImport: i0, template: "<!-- why: `(keydown.escape)` \u0111\u01B0\u1EE3c gom l\u00EAn HOST c\u1EE7a component (xem `host` trong main.component.ts).\n Tr\u01B0\u1EDBc \u0111\u00E2y n\u00F3 n\u1EB1m tr\u00EAn div b\u1ECDc v\u00E0 tr\u00EAn <section> flyout \u2014 c\u1EA3 hai \u0111\u1EC1u KH\u00D4NG focusable n\u00EAn ch\u1EC9\n \"ch\u1EA1y nh\u1EDD\" event n\u1ED5i b\u1ECDt t\u1EEB con, \u0111\u1ED3ng th\u1EDDi khi\u1EBFn markup khai b\u00E1o interaction handler tr\u00EAn\n ph\u1EA7n t\u1EED kh\u00F4ng nh\u1EADn \u0111\u01B0\u1EE3c focus. Host l\u00E0 t\u1ED5 ti\u00EAn c\u1EE7a t\u1EA5t c\u1EA3 n\u00EAn h\u00E0nh vi gi\u1EEF nguy\u00EAn. -->\n<div class=\"sd-sidebar-v2\">\n <aside class=\"sd-sidebar-v2__rail d-flex flex-column align-items-center gap-8 py-12 bg-white border-right border-black200\">\n <button type=\"button\" class=\"sd-sidebar-v2__brand d-flex align-items-center justify-content-center\" [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-v2__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\"></sd-icon>\n }\n </button>\n\n <nav class=\"d-flex flex-column align-items-center gap-4 flex-1\" [attr.aria-label]=\"'core.module.layout.sidebar.menu-groups' | sdTranslate\">\n @for (item of railItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__rail-action d-flex flex-column align-items-center justify-content-center gap-4\"\n [attr.data-v2-group-key]=\"item.key\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-expanded]=\"activeGroupKey() === item.key && isFlyoutOpen()\"\n [class.sd-sidebar-v2__rail-action--active]=\"activeGroupKey() === item.key\"\n (click)=\"selectGroup(item.menu)\"\n (mouseenter)=\"previewGroup(item.menu)\"\n (focus)=\"previewGroup(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v2__rail-icon\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-v2__rail-label text-ellipsis\">{{ item.title }}</span>\n </button>\n }\n </nav>\n\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"true\"></sd-layout-user-menu>\n </aside>\n\n @if (isFlyoutOpen()) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__backdrop\"\n [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\"\n (click)=\"closeFromBackdrop()\"\n (keydown.escape)=\"closeFromEscape()\"></button>\n <section\n class=\"sd-sidebar-v2__flyout d-flex flex-column bg-white border-right border-black200 mat-elevation-z4\"\n role=\"region\"\n [attr.aria-label]=\"activeGroup()?.title || 'Menu'\"\n (mouseleave)=\"leaveFlyout()\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ activeGroup()?.title || sidebar().defaultTitle || 'Menu' }}</span>\n @if (isFlyoutLocked()) {\n <sd-icon name=\"lock\"></sd-icon>\n }\n </header>\n <div class=\"p-12\">\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-group' | sdTranslate\"\n [autoId]=\"'layout-v2-context-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"flex-1 overflow-auto px-8 pb-12\">\n <sd-layout-menu-tree\n [menus]=\"contextMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n\n <main class=\"sd-sidebar-v2__content\" data-v2-content data-content-offset=\"rail\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v2{min-height:100vh;background:var(--sd-light)}.sd-sidebar-v2__rail{position:fixed;z-index:var(--sd-z-header, 30);inset:0 auto 0 0;width:72px}.sd-sidebar-v2__brand,.sd-sidebar-v2__rail-action{width:56px;min-height:52px;border:0;border-radius:var(--sd-radius-10, 10px);background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-v2__rail-action:hover,.sd-sidebar-v2__rail-action--active{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v2__brand:focus-visible,.sd-sidebar-v2__rail-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v2__rail-label{width:52px;font-size:var(--sd-font-size-10, 10px);line-height:12px;text-align:center}.sd-sidebar-v2__logo,.sd-sidebar-v2__rail-icon{width:24px;height:24px;object-fit:contain}.sd-sidebar-v2__backdrop{position:fixed;z-index:10;inset:0;border:0;background:transparent}.sd-sidebar-v2__flyout{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 72px;width:320px}.sd-sidebar-v2__content{min-height:100vh;margin-left:72px}@media(prefers-reduced-motion:reduce){.sd-sidebar-v2__flyout{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3032
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV2, isStandalone: true, selector: "sd-sidebar-v2", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown.escape": "closeFromEscape()" } }, ngImport: i0, template: "<!-- why: `(keydown.escape)` \u0111\u01B0\u1EE3c gom l\u00EAn HOST c\u1EE7a component (xem `host` trong main.component.ts).\n Tr\u01B0\u1EDBc \u0111\u00E2y n\u00F3 n\u1EB1m tr\u00EAn div b\u1ECDc v\u00E0 tr\u00EAn <section> flyout \u2014 c\u1EA3 hai \u0111\u1EC1u KH\u00D4NG focusable n\u00EAn ch\u1EC9\n \"ch\u1EA1y nh\u1EDD\" event n\u1ED5i b\u1ECDt t\u1EEB con, \u0111\u1ED3ng th\u1EDDi khi\u1EBFn markup khai b\u00E1o interaction handler tr\u00EAn\n ph\u1EA7n t\u1EED kh\u00F4ng nh\u1EADn \u0111\u01B0\u1EE3c focus. Host l\u00E0 t\u1ED5 ti\u00EAn c\u1EE7a t\u1EA5t c\u1EA3 n\u00EAn h\u00E0nh vi gi\u1EEF nguy\u00EAn. -->\n<div class=\"sd-sidebar-v2\">\n <aside #railElement class=\"sd-sidebar-v2__rail d-flex flex-column align-items-center gap-8 py-12 bg-white border-right border-black200\">\n <button type=\"button\" class=\"sd-sidebar-v2__brand d-flex align-items-center justify-content-center\" [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-v2__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\"></sd-icon>\n }\n </button>\n\n <!-- Context switcher (D-010): avatar context ngay d\u01B0\u1EDBi n\u00FAt brand; popover m\u1EDF sang ph\u1EA3i t\u1EEB m\u00E9p rail.\n N\u1EB1m ngo\u00E0i <nav> nh\u00F3m n\u00EAn kh\u00F4ng c\u00F3 mouseenter/focus preview flyout. -->\n @if (sidebar().context; as context) {\n <sd-layout-context-switcher class=\"sd-sidebar-v2__rail-context\" appearance=\"rail\" [configuration]=\"context\" [anchor]=\"railElement\" />\n }\n\n <nav class=\"d-flex flex-column align-items-center gap-4 flex-1\" [attr.aria-label]=\"'core.module.layout.sidebar.menu-groups' | sdTranslate\">\n @for (item of railItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__rail-action d-flex flex-column align-items-center justify-content-center gap-4\"\n [attr.data-v2-group-key]=\"item.key\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-expanded]=\"activeGroupKey() === item.key && isFlyoutOpen()\"\n [class.sd-sidebar-v2__rail-action--active]=\"activeGroupKey() === item.key\"\n (click)=\"selectGroup(item.menu)\"\n (mouseenter)=\"previewGroup(item.menu)\"\n (focus)=\"previewGroup(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v2__rail-icon\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-v2__rail-label text-ellipsis\">{{ item.title }}</span>\n </button>\n }\n </nav>\n\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"true\"></sd-layout-user-menu>\n </aside>\n\n @if (isFlyoutOpen()) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__backdrop\"\n [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\"\n (click)=\"closeFromBackdrop()\"\n (keydown.escape)=\"closeFromEscape()\"></button>\n <section\n class=\"sd-sidebar-v2__flyout d-flex flex-column bg-white border-right border-black200 mat-elevation-z4\"\n role=\"region\"\n [attr.aria-label]=\"activeGroup()?.title || 'Menu'\"\n (mouseleave)=\"leaveFlyout()\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ activeGroup()?.title || sidebar().defaultTitle || 'Menu' }}</span>\n @if (isFlyoutLocked()) {\n <sd-icon name=\"lock\"></sd-icon>\n }\n </header>\n <div class=\"p-12\">\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-group' | sdTranslate\"\n [autoId]=\"'layout-v2-context-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"flex-1 overflow-auto px-8 pb-12\">\n <sd-layout-menu-tree\n [menus]=\"contextMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n\n <main class=\"sd-sidebar-v2__content\" data-v2-content data-content-offset=\"rail\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v2{min-height:100vh;background:var(--sd-light)}.sd-sidebar-v2__rail{position:fixed;z-index:var(--sd-z-header, 30);inset:0 auto 0 0;width:72px}.sd-sidebar-v2__brand,.sd-sidebar-v2__rail-action{width:56px;min-height:52px;border:0;border-radius:var(--sd-radius-10, 10px);background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-v2__rail-action:hover,.sd-sidebar-v2__rail-action--active{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v2__brand:focus-visible,.sd-sidebar-v2__rail-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v2__rail-context:empty{display:none}.sd-sidebar-v2__rail-label{width:52px;font-size:var(--sd-font-size-10, 10px);line-height:12px;text-align:center}.sd-sidebar-v2__logo,.sd-sidebar-v2__rail-icon{width:24px;height:24px;object-fit:contain}.sd-sidebar-v2__backdrop{position:fixed;z-index:10;inset:0;border:0;background:transparent}.sd-sidebar-v2__flyout{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 72px;width:320px}.sd-sidebar-v2__content{min-height:100vh;margin-left:72px}@media(prefers-reduced-motion:reduce){.sd-sidebar-v2__flyout{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2290
3033
|
}
|
|
2291
3034
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV2, decorators: [{
|
|
2292
3035
|
type: Component,
|
|
2293
|
-
args: [{ selector: 'sd-sidebar-v2', standalone: true, imports: [
|
|
3036
|
+
args: [{ selector: 'sd-sidebar-v2', standalone: true, imports: [
|
|
3037
|
+
SdIcon,
|
|
3038
|
+
SdLayoutSearchFieldComponent,
|
|
3039
|
+
SdLayoutMenuTreeComponent,
|
|
3040
|
+
SdLayoutUserMenuComponent,
|
|
3041
|
+
SdLayoutContextSwitcher,
|
|
3042
|
+
SdTranslatePipe,
|
|
3043
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2294
3044
|
'(keydown.escape)': 'closeFromEscape()',
|
|
2295
|
-
}, template: "<!-- why: `(keydown.escape)` \u0111\u01B0\u1EE3c gom l\u00EAn HOST c\u1EE7a component (xem `host` trong main.component.ts).\n Tr\u01B0\u1EDBc \u0111\u00E2y n\u00F3 n\u1EB1m tr\u00EAn div b\u1ECDc v\u00E0 tr\u00EAn <section> flyout \u2014 c\u1EA3 hai \u0111\u1EC1u KH\u00D4NG focusable n\u00EAn ch\u1EC9\n \"ch\u1EA1y nh\u1EDD\" event n\u1ED5i b\u1ECDt t\u1EEB con, \u0111\u1ED3ng th\u1EDDi khi\u1EBFn markup khai b\u00E1o interaction handler tr\u00EAn\n ph\u1EA7n t\u1EED kh\u00F4ng nh\u1EADn \u0111\u01B0\u1EE3c focus. Host l\u00E0 t\u1ED5 ti\u00EAn c\u1EE7a t\u1EA5t c\u1EA3 n\u00EAn h\u00E0nh vi gi\u1EEF nguy\u00EAn. -->\n<div class=\"sd-sidebar-v2\">\n <aside class=\"sd-sidebar-v2__rail d-flex flex-column align-items-center gap-8 py-12 bg-white border-right border-black200\">\n <button type=\"button\" class=\"sd-sidebar-v2__brand d-flex align-items-center justify-content-center\" [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-v2__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\"></sd-icon>\n }\n </button>\n\n <nav class=\"d-flex flex-column align-items-center gap-4 flex-1\" [attr.aria-label]=\"'core.module.layout.sidebar.menu-groups' | sdTranslate\">\n @for (item of railItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__rail-action d-flex flex-column align-items-center justify-content-center gap-4\"\n [attr.data-v2-group-key]=\"item.key\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-expanded]=\"activeGroupKey() === item.key && isFlyoutOpen()\"\n [class.sd-sidebar-v2__rail-action--active]=\"activeGroupKey() === item.key\"\n (click)=\"selectGroup(item.menu)\"\n (mouseenter)=\"previewGroup(item.menu)\"\n (focus)=\"previewGroup(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v2__rail-icon\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-v2__rail-label text-ellipsis\">{{ item.title }}</span>\n </button>\n }\n </nav>\n\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"true\"></sd-layout-user-menu>\n </aside>\n\n @if (isFlyoutOpen()) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__backdrop\"\n [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\"\n (click)=\"closeFromBackdrop()\"\n (keydown.escape)=\"closeFromEscape()\"></button>\n <section\n class=\"sd-sidebar-v2__flyout d-flex flex-column bg-white border-right border-black200 mat-elevation-z4\"\n role=\"region\"\n [attr.aria-label]=\"activeGroup()?.title || 'Menu'\"\n (mouseleave)=\"leaveFlyout()\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ activeGroup()?.title || sidebar().defaultTitle || 'Menu' }}</span>\n @if (isFlyoutLocked()) {\n <sd-icon name=\"lock\"></sd-icon>\n }\n </header>\n <div class=\"p-12\">\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-group' | sdTranslate\"\n [autoId]=\"'layout-v2-context-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"flex-1 overflow-auto px-8 pb-12\">\n <sd-layout-menu-tree\n [menus]=\"contextMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n\n <main class=\"sd-sidebar-v2__content\" data-v2-content data-content-offset=\"rail\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v2{min-height:100vh;background:var(--sd-light)}.sd-sidebar-v2__rail{position:fixed;z-index:var(--sd-z-header, 30);inset:0 auto 0 0;width:72px}.sd-sidebar-v2__brand,.sd-sidebar-v2__rail-action{width:56px;min-height:52px;border:0;border-radius:var(--sd-radius-10, 10px);background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-v2__rail-action:hover,.sd-sidebar-v2__rail-action--active{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v2__brand:focus-visible,.sd-sidebar-v2__rail-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v2__rail-label{width:52px;font-size:var(--sd-font-size-10, 10px);line-height:12px;text-align:center}.sd-sidebar-v2__logo,.sd-sidebar-v2__rail-icon{width:24px;height:24px;object-fit:contain}.sd-sidebar-v2__backdrop{position:fixed;z-index:10;inset:0;border:0;background:transparent}.sd-sidebar-v2__flyout{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 72px;width:320px}.sd-sidebar-v2__content{min-height:100vh;margin-left:72px}@media(prefers-reduced-motion:reduce){.sd-sidebar-v2__flyout{transition:none}}\n"] }]
|
|
3045
|
+
}, template: "<!-- why: `(keydown.escape)` \u0111\u01B0\u1EE3c gom l\u00EAn HOST c\u1EE7a component (xem `host` trong main.component.ts).\n Tr\u01B0\u1EDBc \u0111\u00E2y n\u00F3 n\u1EB1m tr\u00EAn div b\u1ECDc v\u00E0 tr\u00EAn <section> flyout \u2014 c\u1EA3 hai \u0111\u1EC1u KH\u00D4NG focusable n\u00EAn ch\u1EC9\n \"ch\u1EA1y nh\u1EDD\" event n\u1ED5i b\u1ECDt t\u1EEB con, \u0111\u1ED3ng th\u1EDDi khi\u1EBFn markup khai b\u00E1o interaction handler tr\u00EAn\n ph\u1EA7n t\u1EED kh\u00F4ng nh\u1EADn \u0111\u01B0\u1EE3c focus. Host l\u00E0 t\u1ED5 ti\u00EAn c\u1EE7a t\u1EA5t c\u1EA3 n\u00EAn h\u00E0nh vi gi\u1EEF nguy\u00EAn. -->\n<div class=\"sd-sidebar-v2\">\n <aside #railElement class=\"sd-sidebar-v2__rail d-flex flex-column align-items-center gap-8 py-12 bg-white border-right border-black200\">\n <button type=\"button\" class=\"sd-sidebar-v2__brand d-flex align-items-center justify-content-center\" [attr.aria-label]=\"'core.module.layout.home.tab-name' | sdTranslate\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-v2__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\"></sd-icon>\n }\n </button>\n\n <!-- Context switcher (D-010): avatar context ngay d\u01B0\u1EDBi n\u00FAt brand; popover m\u1EDF sang ph\u1EA3i t\u1EEB m\u00E9p rail.\n N\u1EB1m ngo\u00E0i <nav> nh\u00F3m n\u00EAn kh\u00F4ng c\u00F3 mouseenter/focus preview flyout. -->\n @if (sidebar().context; as context) {\n <sd-layout-context-switcher class=\"sd-sidebar-v2__rail-context\" appearance=\"rail\" [configuration]=\"context\" [anchor]=\"railElement\" />\n }\n\n <nav class=\"d-flex flex-column align-items-center gap-4 flex-1\" [attr.aria-label]=\"'core.module.layout.sidebar.menu-groups' | sdTranslate\">\n @for (item of railItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__rail-action d-flex flex-column align-items-center justify-content-center gap-4\"\n [attr.data-v2-group-key]=\"item.key\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-expanded]=\"activeGroupKey() === item.key && isFlyoutOpen()\"\n [class.sd-sidebar-v2__rail-action--active]=\"activeGroupKey() === item.key\"\n (click)=\"selectGroup(item.menu)\"\n (mouseenter)=\"previewGroup(item.menu)\"\n (focus)=\"previewGroup(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v2__rail-icon\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-v2__rail-label text-ellipsis\">{{ item.title }}</span>\n </button>\n }\n </nav>\n\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"true\"></sd-layout-user-menu>\n </aside>\n\n @if (isFlyoutOpen()) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v2__backdrop\"\n [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\"\n (click)=\"closeFromBackdrop()\"\n (keydown.escape)=\"closeFromEscape()\"></button>\n <section\n class=\"sd-sidebar-v2__flyout d-flex flex-column bg-white border-right border-black200 mat-elevation-z4\"\n role=\"region\"\n [attr.aria-label]=\"activeGroup()?.title || 'Menu'\"\n (mouseleave)=\"leaveFlyout()\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ activeGroup()?.title || sidebar().defaultTitle || 'Menu' }}</span>\n @if (isFlyoutLocked()) {\n <sd-icon name=\"lock\"></sd-icon>\n }\n </header>\n <div class=\"p-12\">\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-group' | sdTranslate\"\n [autoId]=\"'layout-v2-context-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"flex-1 overflow-auto px-8 pb-12\">\n <sd-layout-menu-tree\n [menus]=\"contextMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n\n <main class=\"sd-sidebar-v2__content\" data-v2-content data-content-offset=\"rail\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v2{min-height:100vh;background:var(--sd-light)}.sd-sidebar-v2__rail{position:fixed;z-index:var(--sd-z-header, 30);inset:0 auto 0 0;width:72px}.sd-sidebar-v2__brand,.sd-sidebar-v2__rail-action{width:56px;min-height:52px;border:0;border-radius:var(--sd-radius-10, 10px);background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-v2__rail-action:hover,.sd-sidebar-v2__rail-action--active{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v2__brand:focus-visible,.sd-sidebar-v2__rail-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v2__rail-context:empty{display:none}.sd-sidebar-v2__rail-label{width:52px;font-size:var(--sd-font-size-10, 10px);line-height:12px;text-align:center}.sd-sidebar-v2__logo,.sd-sidebar-v2__rail-icon{width:24px;height:24px;object-fit:contain}.sd-sidebar-v2__backdrop{position:fixed;z-index:10;inset:0;border:0;background:transparent}.sd-sidebar-v2__flyout{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 72px;width:320px}.sd-sidebar-v2__content{min-height:100vh;margin-left:72px}@media(prefers-reduced-motion:reduce){.sd-sidebar-v2__flyout{transition:none}}\n"] }]
|
|
2296
3046
|
}], ctorParameters: () => [], propDecorators: { menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }] } });
|
|
2297
3047
|
|
|
2298
3048
|
class SdSidebarMobileV2 {
|
|
@@ -2300,6 +3050,7 @@ class SdSidebarMobileV2 {
|
|
|
2300
3050
|
#i18n = inject(I18nService);
|
|
2301
3051
|
#document = inject(DOCUMENT);
|
|
2302
3052
|
#destroyRef = inject(DestroyRef);
|
|
3053
|
+
#injector = inject(Injector);
|
|
2303
3054
|
#navigationState = inject(SdLayoutNavigationStateService);
|
|
2304
3055
|
#restoreFocusElement = null;
|
|
2305
3056
|
#previousBodyOverflow = '';
|
|
@@ -2334,6 +3085,16 @@ class SdSidebarMobileV2 {
|
|
|
2334
3085
|
const menus = this.menus();
|
|
2335
3086
|
untracked(() => this.#navigationState.hydrate(menus));
|
|
2336
3087
|
});
|
|
3088
|
+
// why: switcher chỉ mount trong sheet menu (render khi mở) — đối chiếu context ngay lúc khởi tạo (EXEC-D1, D-021)
|
|
3089
|
+
// để listener nhiều tab chạy từ đầu và lần chạm đầu vào menu không kích reload đối chiếu. Không có `context` thì
|
|
3090
|
+
// không lấy service: app không cấu hình context không tạo service lẫn listener.
|
|
3091
|
+
effect(() => {
|
|
3092
|
+
const context = this.sidebar().context;
|
|
3093
|
+
if (!context)
|
|
3094
|
+
return;
|
|
3095
|
+
const items = context.items;
|
|
3096
|
+
untracked(() => this.#injector.get(SdLayoutContextService).syncItems(items));
|
|
3097
|
+
});
|
|
2337
3098
|
this.#router.events.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
2338
3099
|
if (!(event instanceof NavigationEnd))
|
|
2339
3100
|
return;
|
|
@@ -2408,17 +3169,27 @@ class SdSidebarMobileV2 {
|
|
|
2408
3169
|
this.#document.body.style.overflow = this.#previousBodyOverflow;
|
|
2409
3170
|
}
|
|
2410
3171
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileV2, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2411
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileV2, isStandalone: true, selector: "sd-sidebar-mobile-v2", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"sd-sidebar-mobile-v2 d-flex flex-column\">\n <main class=\"sd-sidebar-mobile-v2__content flex-1 overflow-auto\">\n <ng-content></ng-content>\n </main>\n\n <nav class=\"sd-sidebar-mobile-v2__bar d-flex align-items-stretch bg-white border-top border-black200\" [attr.aria-label]=\"'core.module.layout.sidebar.primary-nav' | sdTranslate\">\n @for (menu of primaryMenus(); track menu.id || menu.title) {\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__bar-action d-flex flex-column align-items-center justify-content-center gap-4 flex-1\"\n [attr.data-mobile-menu-key]=\"menu.id ? 'id:' + menu.id : null\"\n [attr.aria-label]=\"menu.tooltipTitle || menu.title || 'Menu'\"\n [attr.aria-expanded]=\"sheetGroupKey() === (menu.id ? 'id:' + menu.id : '') && isSheetOpen()\"\n (click)=\"activateMenu(menu, $event.currentTarget)\">\n @if (menu.iconUrl) {\n <img class=\"sd-sidebar-mobile-v2__icon\" [src]=\"menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-mobile-v2__label text-ellipsis\">{{ menu.tooltipTitle || menu.title }}</span>\n </button>\n }\n @if (overflowMenus().length) {\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__bar-action d-flex flex-column align-items-center justify-content-center gap-4 flex-1\"\n [attr.aria-label]=\"'core.module.layout.sidebar.more-menu' | sdTranslate\"\n [attr.aria-expanded]=\"sheetGroupKey() === 'more' && isSheetOpen()\"\n (click)=\"openMore($event.currentTarget)\">\n <sd-icon name=\"more_horiz\"></sd-icon>\n <span class=\"sd-sidebar-mobile-v2__label\">{{ 'core.module.layout.sidebar.more' | sdTranslate }}</span>\n </button>\n }\n </nav>\n\n @if (isSheetOpen()) {\n <button type=\"button\" class=\"sd-sidebar-mobile-v2__backdrop\" [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\" (click)=\"closeSheet()\"></button>\n <section\n data-v2-sheet\n class=\"sd-sidebar-mobile-v2__sheet d-flex flex-column bg-white rounded-top-16 mat-elevation-z8\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"sheetTitle()\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onSheetKeydown($event)\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ sheetTitle() }}</span>\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__close d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"closeSheet()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </header>\n <div class=\"d-flex flex-column gap-12 p-12 overflow-auto\">\n <sd-layout-user-menu presentation=\"mobile-inline\" [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-menu' | sdTranslate\"\n [autoId]=\"'layout-v2-mobile-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n <sd-layout-menu-tree\n [menus]=\"sheetMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n</div>\n", styles: [":host{display:block}.sd-sidebar-mobile-v2{min-height:100dvh;padding-bottom:calc(64px + env(safe-area-inset-bottom));background:var(--sd-light)}.sd-sidebar-mobile-v2__bar{position:fixed;z-index:var(--sd-z-header, 30);inset:auto 0 0;min-height:64px;padding-bottom:env(safe-area-inset-bottom)}.sd-sidebar-mobile-v2__bar-action,.sd-sidebar-mobile-v2__close{min-width:0;min-height:48px;border:0;background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-mobile-v2__bar-action:hover,.sd-sidebar-mobile-v2__close:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-mobile-v2__bar-action:focus-visible,.sd-sidebar-mobile-v2__close:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-sidebar-mobile-v2__label{max-width:72px;font-size:var(--sd-font-size-11, 11px);line-height:14px}.sd-sidebar-mobile-v2__icon{width:22px;height:22px;object-fit:contain}.sd-sidebar-mobile-v2__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;border:0;background:color-mix(in srgb,var(--sd-black) 40%,transparent)}.sd-sidebar-mobile-v2__sheet{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:auto 0 0;max-height:min(78dvh,720px);padding-bottom:env(safe-area-inset-bottom);overflow:hidden}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v2__sheet{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3172
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileV2, isStandalone: true, selector: "sd-sidebar-mobile-v2", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"sd-sidebar-mobile-v2 d-flex flex-column\">\n <main class=\"sd-sidebar-mobile-v2__content flex-1 overflow-auto\">\n <ng-content></ng-content>\n </main>\n\n <nav class=\"sd-sidebar-mobile-v2__bar d-flex align-items-stretch bg-white border-top border-black200\" [attr.aria-label]=\"'core.module.layout.sidebar.primary-nav' | sdTranslate\">\n @for (menu of primaryMenus(); track menu.id || menu.title) {\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__bar-action d-flex flex-column align-items-center justify-content-center gap-4 flex-1\"\n [attr.data-mobile-menu-key]=\"menu.id ? 'id:' + menu.id : null\"\n [attr.aria-label]=\"menu.tooltipTitle || menu.title || 'Menu'\"\n [attr.aria-expanded]=\"sheetGroupKey() === (menu.id ? 'id:' + menu.id : '') && isSheetOpen()\"\n (click)=\"activateMenu(menu, $event.currentTarget)\">\n @if (menu.iconUrl) {\n <img class=\"sd-sidebar-mobile-v2__icon\" [src]=\"menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-mobile-v2__label text-ellipsis\">{{ menu.tooltipTitle || menu.title }}</span>\n </button>\n }\n @if (overflowMenus().length) {\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__bar-action d-flex flex-column align-items-center justify-content-center gap-4 flex-1\"\n [attr.aria-label]=\"'core.module.layout.sidebar.more-menu' | sdTranslate\"\n [attr.aria-expanded]=\"sheetGroupKey() === 'more' && isSheetOpen()\"\n (click)=\"openMore($event.currentTarget)\">\n <sd-icon name=\"more_horiz\"></sd-icon>\n <span class=\"sd-sidebar-mobile-v2__label\">{{ 'core.module.layout.sidebar.more' | sdTranslate }}</span>\n </button>\n }\n </nav>\n\n @if (isSheetOpen()) {\n <button type=\"button\" class=\"sd-sidebar-mobile-v2__backdrop\" [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\" (click)=\"closeSheet()\"></button>\n <section\n data-v2-sheet\n class=\"sd-sidebar-mobile-v2__sheet d-flex flex-column bg-white rounded-top-16 mat-elevation-z8\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"sheetTitle()\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onSheetKeydown($event)\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ sheetTitle() }}</span>\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__close d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"closeSheet()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </header>\n <div class=\"d-flex flex-column gap-12 p-12 overflow-auto\">\n <!-- Context switcher (D-027): mobile V2 kh\u00F4ng c\u00F3 drawer n\u00EAn trigger l\u00E0 d\u00F2ng \u0111\u1EA7u c\u1EE7a sheet menu; sheet ch\u1ECDn\n context m\u1EDF trong overlay CDK, ch\u1ED3ng l\u00EAn sheet n\u00E0y v\u00E0 t\u1EF1 gi\u1EEF Esc (kh\u00F4ng \u0111\u00F3ng sheet menu). -->\n @if (sidebar().context; as context) {\n <sd-layout-context-switcher class=\"sd-sidebar-mobile-v2__context\" appearance=\"sheet\" [configuration]=\"context\" />\n }\n <sd-layout-user-menu presentation=\"mobile-inline\" [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-menu' | sdTranslate\"\n [autoId]=\"'layout-v2-mobile-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n <sd-layout-menu-tree\n [menus]=\"sheetMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n</div>\n", styles: [":host{display:block}.sd-sidebar-mobile-v2{min-height:100dvh;padding-bottom:calc(64px + env(safe-area-inset-bottom));background:var(--sd-light)}.sd-sidebar-mobile-v2__bar{position:fixed;z-index:var(--sd-z-header, 30);inset:auto 0 0;min-height:64px;padding-bottom:env(safe-area-inset-bottom)}.sd-sidebar-mobile-v2__bar-action,.sd-sidebar-mobile-v2__close{min-width:0;min-height:48px;border:0;background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-mobile-v2__bar-action:hover,.sd-sidebar-mobile-v2__close:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-mobile-v2__bar-action:focus-visible,.sd-sidebar-mobile-v2__close:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-sidebar-mobile-v2__label{max-width:72px;font-size:var(--sd-font-size-11, 11px);line-height:14px}.sd-sidebar-mobile-v2__icon{width:22px;height:22px;object-fit:contain}.sd-sidebar-mobile-v2__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;border:0;background:color-mix(in srgb,var(--sd-black) 40%,transparent)}.sd-sidebar-mobile-v2__sheet{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:auto 0 0;max-height:min(78dvh,720px);padding-bottom:env(safe-area-inset-bottom);overflow:hidden}.sd-sidebar-mobile-v2__context:empty{display:none}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v2__sheet{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2412
3173
|
}
|
|
2413
3174
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileV2, decorators: [{
|
|
2414
3175
|
type: Component,
|
|
2415
|
-
args: [{ selector: 'sd-sidebar-mobile-v2', standalone: true, imports: [
|
|
3176
|
+
args: [{ selector: 'sd-sidebar-mobile-v2', standalone: true, imports: [
|
|
3177
|
+
A11yModule,
|
|
3178
|
+
SdIcon,
|
|
3179
|
+
SdLayoutSearchFieldComponent,
|
|
3180
|
+
SdLayoutMenuTreeComponent,
|
|
3181
|
+
SdLayoutUserMenuComponent,
|
|
3182
|
+
SdLayoutContextSwitcher,
|
|
3183
|
+
SdTranslatePipe,
|
|
3184
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"sd-sidebar-mobile-v2 d-flex flex-column\">\n <main class=\"sd-sidebar-mobile-v2__content flex-1 overflow-auto\">\n <ng-content></ng-content>\n </main>\n\n <nav class=\"sd-sidebar-mobile-v2__bar d-flex align-items-stretch bg-white border-top border-black200\" [attr.aria-label]=\"'core.module.layout.sidebar.primary-nav' | sdTranslate\">\n @for (menu of primaryMenus(); track menu.id || menu.title) {\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__bar-action d-flex flex-column align-items-center justify-content-center gap-4 flex-1\"\n [attr.data-mobile-menu-key]=\"menu.id ? 'id:' + menu.id : null\"\n [attr.aria-label]=\"menu.tooltipTitle || menu.title || 'Menu'\"\n [attr.aria-expanded]=\"sheetGroupKey() === (menu.id ? 'id:' + menu.id : '') && isSheetOpen()\"\n (click)=\"activateMenu(menu, $event.currentTarget)\">\n @if (menu.iconUrl) {\n <img class=\"sd-sidebar-mobile-v2__icon\" [src]=\"menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"menu.icon || 'widgets'\"></sd-icon>\n }\n <span class=\"sd-sidebar-mobile-v2__label text-ellipsis\">{{ menu.tooltipTitle || menu.title }}</span>\n </button>\n }\n @if (overflowMenus().length) {\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__bar-action d-flex flex-column align-items-center justify-content-center gap-4 flex-1\"\n [attr.aria-label]=\"'core.module.layout.sidebar.more-menu' | sdTranslate\"\n [attr.aria-expanded]=\"sheetGroupKey() === 'more' && isSheetOpen()\"\n (click)=\"openMore($event.currentTarget)\">\n <sd-icon name=\"more_horiz\"></sd-icon>\n <span class=\"sd-sidebar-mobile-v2__label\">{{ 'core.module.layout.sidebar.more' | sdTranslate }}</span>\n </button>\n }\n </nav>\n\n @if (isSheetOpen()) {\n <button type=\"button\" class=\"sd-sidebar-mobile-v2__backdrop\" [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\" (click)=\"closeSheet()\"></button>\n <section\n data-v2-sheet\n class=\"sd-sidebar-mobile-v2__sheet d-flex flex-column bg-white rounded-top-16 mat-elevation-z8\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"sheetTitle()\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onSheetKeydown($event)\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T16M text-ellipsis\">{{ sheetTitle() }}</span>\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v2__close d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"closeSheet()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </header>\n <div class=\"d-flex flex-column gap-12 p-12 overflow-auto\">\n <!-- Context switcher (D-027): mobile V2 kh\u00F4ng c\u00F3 drawer n\u00EAn trigger l\u00E0 d\u00F2ng \u0111\u1EA7u c\u1EE7a sheet menu; sheet ch\u1ECDn\n context m\u1EDF trong overlay CDK, ch\u1ED3ng l\u00EAn sheet n\u00E0y v\u00E0 t\u1EF1 gi\u1EEF Esc (kh\u00F4ng \u0111\u00F3ng sheet menu). -->\n @if (sidebar().context; as context) {\n <sd-layout-context-switcher class=\"sd-sidebar-mobile-v2__context\" appearance=\"sheet\" [configuration]=\"context\" />\n }\n <sd-layout-user-menu presentation=\"mobile-inline\" [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n <sd-layout-search-field\n [placeholder]=\"'core.module.layout.sidebar.search-in-menu' | sdTranslate\"\n [autoId]=\"'layout-v2-mobile-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n <sd-layout-menu-tree\n [menus]=\"sheetMenus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"onNavigate($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </div>\n </section>\n }\n</div>\n", styles: [":host{display:block}.sd-sidebar-mobile-v2{min-height:100dvh;padding-bottom:calc(64px + env(safe-area-inset-bottom));background:var(--sd-light)}.sd-sidebar-mobile-v2__bar{position:fixed;z-index:var(--sd-z-header, 30);inset:auto 0 0;min-height:64px;padding-bottom:env(safe-area-inset-bottom)}.sd-sidebar-mobile-v2__bar-action,.sd-sidebar-mobile-v2__close{min-width:0;min-height:48px;border:0;background:transparent;color:var(--sd-black400);cursor:pointer}.sd-sidebar-mobile-v2__bar-action:hover,.sd-sidebar-mobile-v2__close:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-mobile-v2__bar-action:focus-visible,.sd-sidebar-mobile-v2__close:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-sidebar-mobile-v2__label{max-width:72px;font-size:var(--sd-font-size-11, 11px);line-height:14px}.sd-sidebar-mobile-v2__icon{width:22px;height:22px;object-fit:contain}.sd-sidebar-mobile-v2__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;border:0;background:color-mix(in srgb,var(--sd-black) 40%,transparent)}.sd-sidebar-mobile-v2__sheet{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:auto 0 0;max-height:min(78dvh,720px);padding-bottom:env(safe-area-inset-bottom);overflow:hidden}.sd-sidebar-mobile-v2__context:empty{display:none}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v2__sheet{transition:none}}\n"] }]
|
|
2416
3185
|
}], ctorParameters: () => [], propDecorators: { menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }] } });
|
|
2417
3186
|
|
|
2418
3187
|
class SdSidebarV3 {
|
|
2419
3188
|
#router = inject(Router);
|
|
2420
3189
|
#destroyRef = inject(DestroyRef);
|
|
2421
3190
|
#navigationState = inject(SdLayoutNavigationStateService);
|
|
3191
|
+
headerSwitcher = viewChild('headerSwitcher', /* @ts-ignore */
|
|
3192
|
+
...(ngDevMode ? [{ debugName: "headerSwitcher" }] : /* istanbul ignore next */ []));
|
|
2422
3193
|
#initialized = false;
|
|
2423
3194
|
menus = input([], /* @ts-ignore */
|
|
2424
3195
|
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
@@ -2443,6 +3214,9 @@ class SdSidebarV3 {
|
|
|
2443
3214
|
recentMenus = this.#navigationState.recentMenus;
|
|
2444
3215
|
collapsedItems = computed(() => this.menus().map(menu => ({ menu, key: getMenuStableKey(menu), title: menu.tooltipTitle || menu.title || 'Menu' })), /* @ts-ignore */
|
|
2445
3216
|
...(ngDevMode ? [{ debugName: "collapsedItems" }] : /* istanbul ignore next */ []));
|
|
3217
|
+
/** The header Context Switcher popover is open; the whole header then takes the hover background (README CS1). */
|
|
3218
|
+
contextOpen = computed(() => this.headerSwitcher()?.isOpen() ?? false, /* @ts-ignore */
|
|
3219
|
+
...(ngDevMode ? [{ debugName: "contextOpen" }] : /* istanbul ignore next */ []));
|
|
2446
3220
|
constructor() {
|
|
2447
3221
|
effect(() => {
|
|
2448
3222
|
const menus = this.menus();
|
|
@@ -2513,17 +3287,25 @@ class SdSidebarV3 {
|
|
|
2513
3287
|
this.#navigationState.togglePinned(menu);
|
|
2514
3288
|
}
|
|
2515
3289
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV3, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2516
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV3, isStandalone: true, selector: "sd-sidebar-v3", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@let collapsed = isCollapsed();\n@let configuration = sidebar();\n@let pinned = pinnedMenus();\n@let recent = recentMenus();\n<div class=\"sd-sidebar-v3\" [class.sd-sidebar-v3--collapsed]=\"collapsed\">\n <aside class=\"sd-sidebar-v3__drawer d-flex flex-column\" data-v3-sidebar [attr.data-collapsed]=\"collapsed\">\n <header\n data-v3-header\n class=\"sd-sidebar-v3__header d-flex align-items-center gap-8 p-12\"\n [class.sd-sidebar-v3__header--collapsed]=\"collapsed\"\n [class.justify-content-between]=\"!collapsed\"\n [class.justify-content-center]=\"collapsed\">\n @if (!collapsed) {\n <div data-v3-brand class=\"d-flex align-items-center gap-8 overflow-hidden\">\n @if (configuration.logoUrl) {\n <img class=\"sd-sidebar-v3__logo\" [src]=\"configuration.logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\" fontSet=\"material-icons-outlined\" size=\"20px\"></sd-icon>\n }\n <span class=\"sd-sidebar-v3__title text-ellipsis\">{{ configuration.defaultTitle || 'Back Office' }}</span>\n </div>\n }\n <button\n type=\"button\"\n class=\"sd-sidebar-v3__icon-action d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"collapsed ? 'M\u1EDF r\u1ED9ng sidebar' : 'Thu g\u1ECDn sidebar'\"\n [attr.aria-expanded]=\"!collapsed\"\n (click)=\"toggleCollapsed()\">\n <sd-icon [name]=\"collapsed ? 'chevron_right' : 'chevron_left'\" size=\"20px\"></sd-icon>\n </button>\n </header>\n\n @if (collapsed) {\n <nav class=\"sd-sidebar-v3__navigation d-flex flex-column align-items-center gap-4 p-8 flex-1 overflow-auto\" aria-label=\"Menu thu g\u1ECDn\">\n @for (item of collapsedItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v3__collapsed-action d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"item.title\"\n [attr.title]=\"item.title\"\n (click)=\"activateCollapsedMenu(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v3__logo\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\" fontSet=\"material-icons-outlined\" size=\"20px\"></sd-icon>\n }\n </button>\n }\n </nav>\n } @else {\n <div class=\"sd-sidebar-v3__search px-12 pb-12\">\n <sd-layout-search-field\n appearance=\"compact\"\n placeholder=\"T\u00ECm trong t\u1EA5t c\u1EA3 menu\"\n [autoId]=\"'layout-v3-global-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"sd-sidebar-v3__navigation d-flex flex-column gap-16 flex-1 overflow-auto px-8 pb-12\">\n @if (pinned.length) {\n <section data-v3-pinned class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"pinned\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n @if (recentConfiguration().enabled && recent.length) {\n <section data-v3-recent class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"recent\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n <section data-v3-all class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.all-menu' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"hierarchy\"\n [collapsible]=\"true\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [menus]=\"menus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n </div>\n }\n\n <div data-v3-footer class=\"sd-sidebar-v3__footer p-8\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"collapsed\"></sd-layout-user-menu>\n </div>\n </aside>\n\n <main class=\"sd-sidebar-v3__content\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v3{--sidebar-surface: var(--sd-white, #fff);--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);min-height:100vh;background:var(--sd-light)}.sd-sidebar-v3__drawer{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 0;width:304px;box-sizing:border-box;background:var(--sidebar-surface);border-right:1px solid var(--sidebar-line);color:var(--sidebar-ink);transition:width .16s ease}.sd-sidebar-v3__header{flex-shrink:0;min-height:64px;box-sizing:border-box}.sd-sidebar-v3__title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px}.sd-sidebar-v3__search{flex-shrink:0}.sd-sidebar-v3__navigation{min-height:0;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}.sd-sidebar-v3__navigation section{flex-shrink:0}.sd-sidebar-v3__section-title{padding:4px 10px;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px;color:var(--sidebar-muted)}.sd-sidebar-v3__footer{flex-shrink:0;border-top:1px solid var(--sidebar-line);background:var(--sidebar-surface)}.sd-sidebar-v3--collapsed .sd-sidebar-v3__drawer{width:72px}.sd-sidebar-v3__content{min-height:100vh;margin-left:304px;transition:margin-left .16s ease}.sd-sidebar-v3--collapsed .sd-sidebar-v3__content{margin-left:72px}.sd-sidebar-v3__icon-action,.sd-sidebar-v3__collapsed-action{width:40px;flex-shrink:0;height:40px;border:0;border-radius:7px;background:transparent;color:var(--sidebar-muted);cursor:pointer}@media(pointer:coarse){.sd-sidebar-v3__icon-action,.sd-sidebar-v3__collapsed-action{width:44px;height:44px}}.sd-sidebar-v3__icon-action:hover,.sd-sidebar-v3__collapsed-action:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v3__icon-action:focus-visible,.sd-sidebar-v3__collapsed-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v3__logo{width:28px;height:28px;object-fit:contain}@media(prefers-reduced-motion:reduce){.sd-sidebar-v3__drawer,.sd-sidebar-v3__content{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3290
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV3, isStandalone: true, selector: "sd-sidebar-v3", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "headerSwitcher", first: true, predicate: ["headerSwitcher"], descendants: true, isSignal: true }], ngImport: i0, template: "@let collapsed = isCollapsed();\n@let configuration = sidebar();\n@let pinned = pinnedMenus();\n@let recent = recentMenus();\n@let title = configuration.defaultTitle || 'Back Office';\n<div class=\"sd-sidebar-v3\" [class.sd-sidebar-v3--collapsed]=\"collapsed\">\n <aside #asideElement class=\"sd-sidebar-v3__drawer d-flex flex-column\" data-v3-sidebar [attr.data-collapsed]=\"collapsed\">\n <header\n #headerElement\n data-v3-header\n class=\"sd-sidebar-v3__header d-flex align-items-center gap-8 p-12\"\n [class.sd-sidebar-v3__header--collapsed]=\"collapsed\"\n [class.sd-sidebar-v3__header--context-open]=\"!collapsed && contextOpen()\"\n [class.justify-content-between]=\"!collapsed\"\n [class.justify-content-center]=\"collapsed\">\n @if (!collapsed) {\n <!-- why: 12px gi\u1EEFa icon v\u00E0 t\u00EAn (nh\u01B0 V4) \u2014 8px tr\u00F4ng d\u00EDnh v\u00E0o kh\u1ED1i t\u00EAn hai d\u00F2ng khi c\u00F3 context. -->\n <div data-v3-brand class=\"d-flex align-items-center gap-12 overflow-hidden\">\n @if (configuration.logoUrl) {\n <img class=\"sd-sidebar-v3__logo\" [src]=\"configuration.logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\" fontSet=\"material-icons-outlined\" size=\"20px\"></sd-icon>\n }\n @if (configuration.context; as context) {\n <!-- Context switcher (R-008, D-010): d\u00F2ng ph\u1EE5 ngay d\u01B0\u1EDBi t\u00EAn app; popover n\u1EB1m d\u01B0\u1EDBi header, th\u1EE5t 12px m\u1ED7i b\u00EAn. -->\n <div class=\"sd-sidebar-v3__brand-text\">\n <span class=\"sd-sidebar-v3__title text-ellipsis\">{{ title }}</span>\n <sd-layout-context-switcher #headerSwitcher appearance=\"header\" [configuration]=\"context\" [anchor]=\"headerElement\" />\n </div>\n } @else {\n <span class=\"sd-sidebar-v3__title text-ellipsis\">{{ title }}</span>\n }\n </div>\n }\n <button\n type=\"button\"\n class=\"sd-sidebar-v3__icon-action d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"collapsed ? 'M\u1EDF r\u1ED9ng sidebar' : 'Thu g\u1ECDn sidebar'\"\n [attr.aria-expanded]=\"!collapsed\"\n (click)=\"toggleCollapsed()\">\n <sd-icon [name]=\"collapsed ? 'chevron_right' : 'chevron_left'\" size=\"20px\"></sd-icon>\n </button>\n </header>\n\n @if (collapsed) {\n @if (configuration.context; as context) {\n <!-- Rail thu g\u1ECDn (D-010): avatar context \u1EDF \u0111\u1EA7u rail, d\u01B0\u1EDBi n\u00FAt m\u1EDF r\u1ED9ng; popover m\u1EDF sang ph\u1EA3i t\u1EEB m\u00E9p drawer. -->\n <sd-layout-context-switcher\n class=\"sd-sidebar-v3__rail-context\"\n appearance=\"rail\"\n [configuration]=\"context\"\n [anchor]=\"asideElement\" />\n }\n <nav class=\"sd-sidebar-v3__navigation d-flex flex-column align-items-center gap-4 p-8 flex-1 overflow-auto\" aria-label=\"Menu thu g\u1ECDn\">\n @for (item of collapsedItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v3__collapsed-action d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"item.title\"\n [attr.title]=\"item.title\"\n (click)=\"activateCollapsedMenu(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v3__logo\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\" fontSet=\"material-icons-outlined\" size=\"20px\"></sd-icon>\n }\n </button>\n }\n </nav>\n } @else {\n <div class=\"sd-sidebar-v3__search px-12 pb-12\">\n <sd-layout-search-field\n appearance=\"compact\"\n placeholder=\"T\u00ECm trong t\u1EA5t c\u1EA3 menu\"\n [autoId]=\"'layout-v3-global-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"sd-sidebar-v3__navigation d-flex flex-column gap-16 flex-1 overflow-auto px-8 pb-12\">\n @if (pinned.length) {\n <section data-v3-pinned class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"pinned\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n @if (recentConfiguration().enabled && recent.length) {\n <section data-v3-recent class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"recent\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n <section data-v3-all class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.all-menu' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"hierarchy\"\n [collapsible]=\"true\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [menus]=\"menus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n </div>\n }\n\n <div data-v3-footer class=\"sd-sidebar-v3__footer p-8\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"collapsed\"></sd-layout-user-menu>\n </div>\n </aside>\n\n <main class=\"sd-sidebar-v3__content\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v3{--sidebar-surface: var(--sd-white, #fff);--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);min-height:100vh;background:var(--sd-light)}.sd-sidebar-v3__drawer{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 0;width:304px;box-sizing:border-box;background:var(--sidebar-surface);border-right:1px solid var(--sidebar-line);color:var(--sidebar-ink);transition:width .16s ease}.sd-sidebar-v3__header{flex-shrink:0;min-height:64px;box-sizing:border-box}.sd-sidebar-v3__title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px}.sd-sidebar-v3__brand-text{--sd-layout-context-switcher-popover-width: 280px ;display:flex;flex-direction:column;min-width:0}.sd-sidebar-v3__header--context-open{border-radius:var(--sd-radius-12, 12px);background:color-mix(in srgb,var(--sd-text) 6%,transparent)}.sd-sidebar-v3__header--context-open ::ng-deep .sd-layout-context-switcher__trigger.sd-layout-context-switcher__trigger--header{background:transparent}.sd-sidebar-v3__rail-context{flex:none}.sd-sidebar-v3__rail-context:not(:empty){margin-bottom:4px}.sd-sidebar-v3__search{flex-shrink:0}.sd-sidebar-v3__navigation{min-height:0;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}.sd-sidebar-v3__navigation section{flex-shrink:0}.sd-sidebar-v3__section-title{padding:4px 10px;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px;color:var(--sidebar-muted)}.sd-sidebar-v3__footer{flex-shrink:0;border-top:1px solid var(--sidebar-line);background:var(--sidebar-surface)}.sd-sidebar-v3--collapsed .sd-sidebar-v3__drawer{width:72px}.sd-sidebar-v3__content{min-height:100vh;margin-left:304px;transition:margin-left .16s ease}.sd-sidebar-v3--collapsed .sd-sidebar-v3__content{margin-left:72px}.sd-sidebar-v3__icon-action,.sd-sidebar-v3__collapsed-action{width:40px;flex-shrink:0;height:40px;border:0;border-radius:7px;background:transparent;color:var(--sidebar-muted);cursor:pointer}@media(pointer:coarse){.sd-sidebar-v3__icon-action,.sd-sidebar-v3__collapsed-action{width:44px;height:44px}}.sd-sidebar-v3__icon-action:hover,.sd-sidebar-v3__collapsed-action:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v3__icon-action:focus-visible,.sd-sidebar-v3__collapsed-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v3__logo{width:28px;height:28px;object-fit:contain}@media(prefers-reduced-motion:reduce){.sd-sidebar-v3__drawer,.sd-sidebar-v3__content{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2517
3291
|
}
|
|
2518
3292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV3, decorators: [{
|
|
2519
3293
|
type: Component,
|
|
2520
|
-
args: [{ selector: 'sd-sidebar-v3', standalone: true, imports: [
|
|
2521
|
-
|
|
3294
|
+
args: [{ selector: 'sd-sidebar-v3', standalone: true, imports: [
|
|
3295
|
+
SdIcon,
|
|
3296
|
+
SdLayoutContextSwitcher,
|
|
3297
|
+
SdLayoutSearchFieldComponent,
|
|
3298
|
+
SdLayoutMenuTreeComponent,
|
|
3299
|
+
SdLayoutUserMenuComponent,
|
|
3300
|
+
SdTranslatePipe,
|
|
3301
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let collapsed = isCollapsed();\n@let configuration = sidebar();\n@let pinned = pinnedMenus();\n@let recent = recentMenus();\n@let title = configuration.defaultTitle || 'Back Office';\n<div class=\"sd-sidebar-v3\" [class.sd-sidebar-v3--collapsed]=\"collapsed\">\n <aside #asideElement class=\"sd-sidebar-v3__drawer d-flex flex-column\" data-v3-sidebar [attr.data-collapsed]=\"collapsed\">\n <header\n #headerElement\n data-v3-header\n class=\"sd-sidebar-v3__header d-flex align-items-center gap-8 p-12\"\n [class.sd-sidebar-v3__header--collapsed]=\"collapsed\"\n [class.sd-sidebar-v3__header--context-open]=\"!collapsed && contextOpen()\"\n [class.justify-content-between]=\"!collapsed\"\n [class.justify-content-center]=\"collapsed\">\n @if (!collapsed) {\n <!-- why: 12px gi\u1EEFa icon v\u00E0 t\u00EAn (nh\u01B0 V4) \u2014 8px tr\u00F4ng d\u00EDnh v\u00E0o kh\u1ED1i t\u00EAn hai d\u00F2ng khi c\u00F3 context. -->\n <div data-v3-brand class=\"d-flex align-items-center gap-12 overflow-hidden\">\n @if (configuration.logoUrl) {\n <img class=\"sd-sidebar-v3__logo\" [src]=\"configuration.logoUrl\" alt=\"\" />\n } @else {\n <sd-icon name=\"apps\" fontSet=\"material-icons-outlined\" size=\"20px\"></sd-icon>\n }\n @if (configuration.context; as context) {\n <!-- Context switcher (R-008, D-010): d\u00F2ng ph\u1EE5 ngay d\u01B0\u1EDBi t\u00EAn app; popover n\u1EB1m d\u01B0\u1EDBi header, th\u1EE5t 12px m\u1ED7i b\u00EAn. -->\n <div class=\"sd-sidebar-v3__brand-text\">\n <span class=\"sd-sidebar-v3__title text-ellipsis\">{{ title }}</span>\n <sd-layout-context-switcher #headerSwitcher appearance=\"header\" [configuration]=\"context\" [anchor]=\"headerElement\" />\n </div>\n } @else {\n <span class=\"sd-sidebar-v3__title text-ellipsis\">{{ title }}</span>\n }\n </div>\n }\n <button\n type=\"button\"\n class=\"sd-sidebar-v3__icon-action d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"collapsed ? 'M\u1EDF r\u1ED9ng sidebar' : 'Thu g\u1ECDn sidebar'\"\n [attr.aria-expanded]=\"!collapsed\"\n (click)=\"toggleCollapsed()\">\n <sd-icon [name]=\"collapsed ? 'chevron_right' : 'chevron_left'\" size=\"20px\"></sd-icon>\n </button>\n </header>\n\n @if (collapsed) {\n @if (configuration.context; as context) {\n <!-- Rail thu g\u1ECDn (D-010): avatar context \u1EDF \u0111\u1EA7u rail, d\u01B0\u1EDBi n\u00FAt m\u1EDF r\u1ED9ng; popover m\u1EDF sang ph\u1EA3i t\u1EEB m\u00E9p drawer. -->\n <sd-layout-context-switcher\n class=\"sd-sidebar-v3__rail-context\"\n appearance=\"rail\"\n [configuration]=\"context\"\n [anchor]=\"asideElement\" />\n }\n <nav class=\"sd-sidebar-v3__navigation d-flex flex-column align-items-center gap-4 p-8 flex-1 overflow-auto\" aria-label=\"Menu thu g\u1ECDn\">\n @for (item of collapsedItems(); track item.key) {\n <button\n type=\"button\"\n class=\"sd-sidebar-v3__collapsed-action d-flex align-items-center justify-content-center\"\n [attr.aria-label]=\"item.title\"\n [attr.title]=\"item.title\"\n (click)=\"activateCollapsedMenu(item.menu)\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-v3__logo\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon [name]=\"item.menu.icon || 'widgets'\" fontSet=\"material-icons-outlined\" size=\"20px\"></sd-icon>\n }\n </button>\n }\n </nav>\n } @else {\n <div class=\"sd-sidebar-v3__search px-12 pb-12\">\n <sd-layout-search-field\n appearance=\"compact\"\n placeholder=\"T\u00ECm trong t\u1EA5t c\u1EA3 menu\"\n [autoId]=\"'layout-v3-global-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n <div class=\"sd-sidebar-v3__navigation d-flex flex-column gap-16 flex-1 overflow-auto px-8 pb-12\">\n @if (pinned.length) {\n <section data-v3-pinned class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"pinned\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n @if (recentConfiguration().enabled && recent.length) {\n <section data-v3-recent class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"recent\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n <section data-v3-all class=\"d-flex flex-column gap-4\">\n <h2 class=\"sd-sidebar-v3__section-title m-0\">{{ 'core.module.layout.sidebar.all-menu' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n presentation=\"hierarchy\"\n [collapsible]=\"true\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [menus]=\"menus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n </div>\n }\n\n <div data-v3-footer class=\"sd-sidebar-v3__footer p-8\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"collapsed\"></sd-layout-user-menu>\n </div>\n </aside>\n\n <main class=\"sd-sidebar-v3__content\">\n <ng-content></ng-content>\n </main>\n</div>\n", styles: [".sd-sidebar-v3{--sidebar-surface: var(--sd-white, #fff);--sidebar-line: color-mix(in srgb, var(--sd-border, #c4c6d0) 45%, var(--sidebar-surface));--sidebar-ink: var(--sd-text, #252c38);--sidebar-muted: var(--sd-text-secondary, #6b7280);min-height:100vh;background:var(--sd-light)}.sd-sidebar-v3__drawer{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 0;width:304px;box-sizing:border-box;background:var(--sidebar-surface);border-right:1px solid var(--sidebar-line);color:var(--sidebar-ink);transition:width .16s ease}.sd-sidebar-v3__header{flex-shrink:0;min-height:64px;box-sizing:border-box}.sd-sidebar-v3__title{font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px}.sd-sidebar-v3__brand-text{--sd-layout-context-switcher-popover-width: 280px ;display:flex;flex-direction:column;min-width:0}.sd-sidebar-v3__header--context-open{border-radius:var(--sd-radius-12, 12px);background:color-mix(in srgb,var(--sd-text) 6%,transparent)}.sd-sidebar-v3__header--context-open ::ng-deep .sd-layout-context-switcher__trigger.sd-layout-context-switcher__trigger--header{background:transparent}.sd-sidebar-v3__rail-context{flex:none}.sd-sidebar-v3__rail-context:not(:empty){margin-bottom:4px}.sd-sidebar-v3__search{flex-shrink:0}.sd-sidebar-v3__navigation{min-height:0;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}.sd-sidebar-v3__navigation section{flex-shrink:0}.sd-sidebar-v3__section-title{padding:4px 10px;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px;color:var(--sidebar-muted)}.sd-sidebar-v3__footer{flex-shrink:0;border-top:1px solid var(--sidebar-line);background:var(--sidebar-surface)}.sd-sidebar-v3--collapsed .sd-sidebar-v3__drawer{width:72px}.sd-sidebar-v3__content{min-height:100vh;margin-left:304px;transition:margin-left .16s ease}.sd-sidebar-v3--collapsed .sd-sidebar-v3__content{margin-left:72px}.sd-sidebar-v3__icon-action,.sd-sidebar-v3__collapsed-action{width:40px;flex-shrink:0;height:40px;border:0;border-radius:7px;background:transparent;color:var(--sidebar-muted);cursor:pointer}@media(pointer:coarse){.sd-sidebar-v3__icon-action,.sd-sidebar-v3__collapsed-action{width:44px;height:44px}}.sd-sidebar-v3__icon-action:hover,.sd-sidebar-v3__collapsed-action:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-v3__icon-action:focus-visible,.sd-sidebar-v3__collapsed-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-v3__logo{width:28px;height:28px;object-fit:contain}@media(prefers-reduced-motion:reduce){.sd-sidebar-v3__drawer,.sd-sidebar-v3__content{transition:none}}\n"] }]
|
|
3302
|
+
}], ctorParameters: () => [], propDecorators: { headerSwitcher: [{ type: i0.ViewChild, args: ['headerSwitcher', { isSignal: true }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }] } });
|
|
2522
3303
|
|
|
2523
3304
|
class SdSidebarMobileV3 {
|
|
2524
3305
|
#router = inject(Router);
|
|
2525
3306
|
#document = inject(DOCUMENT);
|
|
2526
3307
|
#destroyRef = inject(DestroyRef);
|
|
3308
|
+
#injector = inject(Injector);
|
|
2527
3309
|
#navigationState = inject(SdLayoutNavigationStateService);
|
|
2528
3310
|
trigger = viewChild('trigger', /* @ts-ignore */
|
|
2529
3311
|
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
@@ -2554,6 +3336,16 @@ class SdSidebarMobileV3 {
|
|
|
2554
3336
|
const maximum = resolveSidebarV3Recent(this.sidebar()).maxItems;
|
|
2555
3337
|
untracked(() => this.#navigationState.hydrate(menus, maximum));
|
|
2556
3338
|
});
|
|
3339
|
+
// why: switcher chỉ mount khi drawer mở — đối chiếu context ngay lúc khởi tạo (EXEC-D1, D-021) để listener nhiều tab
|
|
3340
|
+
// chạy từ đầu và lần chạm đầu vào menu không kích reload đối chiếu. Không có `context` thì không lấy service: app
|
|
3341
|
+
// không cấu hình context không tạo service lẫn listener.
|
|
3342
|
+
effect(() => {
|
|
3343
|
+
const context = this.sidebar().context;
|
|
3344
|
+
if (!context)
|
|
3345
|
+
return;
|
|
3346
|
+
const items = context.items;
|
|
3347
|
+
untracked(() => this.#injector.get(SdLayoutContextService).syncItems(items));
|
|
3348
|
+
});
|
|
2557
3349
|
this.#router.events.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
2558
3350
|
if (!(event instanceof NavigationEnd))
|
|
2559
3351
|
return;
|
|
@@ -2624,28 +3416,1082 @@ class SdSidebarMobileV3 {
|
|
|
2624
3416
|
this.#document.body.style.overflow = this.#previousBodyOverflow;
|
|
2625
3417
|
}
|
|
2626
3418
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileV3, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2627
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileV3, isStandalone: true, selector: "sd-sidebar-mobile-v3", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"sd-sidebar-mobile-v3 d-flex flex-column\">\n <header\n class=\"sd-sidebar-mobile-v3__topbar d-flex align-items-center justify-content-between gap-8 px-16 bg-white border-bottom border-black200\">\n <div class=\"d-flex align-items-center gap-8 overflow-hidden\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-mobile-v3__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n }\n <span class=\"T16M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n </div>\n <button\n #trigger\n type=\"button\"\n data-v3-mobile-trigger\n class=\"sd-sidebar-mobile-v3__icon-action d-flex align-items-center justify-content-center\"\n aria-label=\"M\u1EDF menu\"\n [attr.aria-expanded]=\"isDrawerOpen()\"\n (click)=\"openDrawer($event.currentTarget)\">\n <sd-icon name=\"menu\"></sd-icon>\n </button>\n </header>\n\n <main class=\"flex-1 overflow-auto\">\n <ng-content></ng-content>\n </main>\n\n @if (isDrawerOpen()) {\n <button type=\"button\" class=\"sd-sidebar-mobile-v3__backdrop\" aria-label=\"\u0110\u00F3ng menu\" (click)=\"closeFromBackdrop()\"></button>\n <aside\n class=\"sd-sidebar-mobile-v3__drawer d-flex flex-column bg-white mat-elevation-z8\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Menu ch\u00EDnh\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onDrawerKeydown($event)\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n <span class=\"T18M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v3__icon-action d-flex align-items-center justify-content-center\"\n aria-label=\"\u0110\u00F3ng menu\"\n (click)=\"closeFromBackdrop()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </header>\n <div class=\"sd-sidebar-mobile-v3__navigation d-flex flex-column gap-16 flex-1 overflow-auto p-12\">\n <sd-layout-user-menu presentation=\"mobile-inline\" [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n <div class=\"sd-sidebar-mobile-v3__search bg-white\">\n <sd-layout-search-field\n placeholder=\"T\u00ECm trong t\u1EA5t c\u1EA3 menu\"\n [autoId]=\"'layout-v3-mobile-global-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n @if (pinnedMenus().length) {\n <section data-v3-mobile-pinned class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n [menus]=\"pinnedMenus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n @if (recentConfiguration().enabled && recentMenus().length) {\n <section data-v3-mobile-recent class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-layout-menu-tree [menus]=\"recentMenus()\" [activePath]=\"activePath()\" [showPin]=\"false\" (navigate)=\"navigateMenu($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n <section class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.all-menu' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n [menus]=\"menus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n </div>\n </aside>\n }\n</div>\n", styles: [":host{display:block}.sd-sidebar-mobile-v3{min-height:100dvh;background:var(--sd-light)}.sd-sidebar-mobile-v3__topbar{min-height:56px}.sd-sidebar-mobile-v3__icon-action{width:40px;height:40px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:var(--sd-black500);cursor:pointer}.sd-sidebar-mobile-v3__icon-action:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-mobile-v3__icon-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-mobile-v3__logo{width:28px;height:28px;object-fit:contain}.sd-sidebar-mobile-v3__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;border:0;background:color-mix(in srgb,var(--sd-black) 40%,transparent)}.sd-sidebar-mobile-v3__drawer{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:0 auto 0 0;width:min(88vw,360px);max-width:100%;padding-bottom:env(safe-area-inset-bottom)}.sd-sidebar-mobile-v3__search{position:sticky;z-index:2;top:-12px;margin:-12px;padding:12px;background:var(--sd-white, #fff)}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v3__drawer{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3419
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileV3, isStandalone: true, selector: "sd-sidebar-mobile-v3", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"sd-sidebar-mobile-v3 d-flex flex-column\">\n <header\n class=\"sd-sidebar-mobile-v3__topbar d-flex align-items-center justify-content-between gap-8 px-16 bg-white border-bottom border-black200\">\n <div class=\"d-flex align-items-center gap-8 overflow-hidden\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-mobile-v3__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n }\n <span class=\"T16M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n </div>\n <button\n #trigger\n type=\"button\"\n data-v3-mobile-trigger\n class=\"sd-sidebar-mobile-v3__icon-action d-flex align-items-center justify-content-center\"\n aria-label=\"M\u1EDF menu\"\n [attr.aria-expanded]=\"isDrawerOpen()\"\n (click)=\"openDrawer($event.currentTarget)\">\n <sd-icon name=\"menu\"></sd-icon>\n </button>\n </header>\n\n <main class=\"flex-1 overflow-auto\">\n <ng-content></ng-content>\n </main>\n\n @if (isDrawerOpen()) {\n <button type=\"button\" class=\"sd-sidebar-mobile-v3__backdrop\" aria-label=\"\u0110\u00F3ng menu\" (click)=\"closeFromBackdrop()\"></button>\n <aside\n class=\"sd-sidebar-mobile-v3__drawer d-flex flex-column bg-white mat-elevation-z8\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Menu ch\u00EDnh\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onDrawerKeydown($event)\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n @if (sidebar().context; as context) {\n <!-- Context switcher (R-008, D-027): trigger ngay d\u01B0\u1EDBi t\u00EAn app; sheet ch\u1ECDn context m\u1EDF trong overlay CDK, ch\u1ED3ng l\u00EAn\n drawer v\u00E0 t\u1EF1 gi\u1EEF Esc (kh\u00F4ng \u0111\u00F3ng drawer). -->\n <div class=\"sd-sidebar-mobile-v3__brand\">\n <span class=\"T18M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n <sd-layout-context-switcher appearance=\"sheet\" [configuration]=\"context\" />\n </div>\n } @else {\n <span class=\"T18M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n }\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v3__icon-action d-flex align-items-center justify-content-center\"\n aria-label=\"\u0110\u00F3ng menu\"\n (click)=\"closeFromBackdrop()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </header>\n <div class=\"sd-sidebar-mobile-v3__navigation d-flex flex-column gap-16 flex-1 overflow-auto p-12\">\n <sd-layout-user-menu presentation=\"mobile-inline\" [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n <div class=\"sd-sidebar-mobile-v3__search bg-white\">\n <sd-layout-search-field\n placeholder=\"T\u00ECm trong t\u1EA5t c\u1EA3 menu\"\n [autoId]=\"'layout-v3-mobile-global-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n @if (pinnedMenus().length) {\n <section data-v3-mobile-pinned class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n [menus]=\"pinnedMenus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n @if (recentConfiguration().enabled && recentMenus().length) {\n <section data-v3-mobile-recent class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-layout-menu-tree [menus]=\"recentMenus()\" [activePath]=\"activePath()\" [showPin]=\"false\" (navigate)=\"navigateMenu($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n <section class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.all-menu' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n [menus]=\"menus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n </div>\n </aside>\n }\n</div>\n", styles: [":host{display:block}.sd-sidebar-mobile-v3{min-height:100dvh;background:var(--sd-light)}.sd-sidebar-mobile-v3__topbar{min-height:56px}.sd-sidebar-mobile-v3__icon-action{width:40px;height:40px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:var(--sd-black500);cursor:pointer}.sd-sidebar-mobile-v3__icon-action:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-mobile-v3__icon-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-mobile-v3__logo{width:28px;height:28px;object-fit:contain}.sd-sidebar-mobile-v3__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;border:0;background:color-mix(in srgb,var(--sd-black) 40%,transparent)}.sd-sidebar-mobile-v3__drawer{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:0 auto 0 0;width:min(88vw,360px);max-width:100%;padding-bottom:env(safe-area-inset-bottom)}.sd-sidebar-mobile-v3__brand{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.sd-sidebar-mobile-v3__search{position:sticky;z-index:2;top:-12px;margin:-12px;padding:12px;background:var(--sd-white, #fff)}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v3__drawer{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "component", type: SdLayoutSearchFieldComponent, selector: "sd-layout-search-field", inputs: ["model", "placeholder", "autoId", "appearance"], outputs: ["sdChange"] }, { kind: "component", type: SdLayoutMenuTreeComponent, selector: "sd-layout-menu-tree", inputs: ["menus", "query", "activePath", "pinnedKeys", "showPin", "pinVisibility", "presentation", "collapsible", "collapsedGroupKeys"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2628
3420
|
}
|
|
2629
3421
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileV3, decorators: [{
|
|
2630
3422
|
type: Component,
|
|
2631
|
-
args: [{ selector: 'sd-sidebar-mobile-v3', standalone: true, imports: [
|
|
3423
|
+
args: [{ selector: 'sd-sidebar-mobile-v3', standalone: true, imports: [
|
|
3424
|
+
A11yModule,
|
|
3425
|
+
SdIcon,
|
|
3426
|
+
SdLayoutContextSwitcher,
|
|
3427
|
+
SdLayoutSearchFieldComponent,
|
|
3428
|
+
SdLayoutMenuTreeComponent,
|
|
3429
|
+
SdLayoutUserMenuComponent,
|
|
3430
|
+
SdTranslatePipe,
|
|
3431
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"sd-sidebar-mobile-v3 d-flex flex-column\">\n <header\n class=\"sd-sidebar-mobile-v3__topbar d-flex align-items-center justify-content-between gap-8 px-16 bg-white border-bottom border-black200\">\n <div class=\"d-flex align-items-center gap-8 overflow-hidden\">\n @if (sidebar().logoUrl) {\n <img class=\"sd-sidebar-mobile-v3__logo\" [src]=\"sidebar().logoUrl\" alt=\"\" />\n }\n <span class=\"T16M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n </div>\n <button\n #trigger\n type=\"button\"\n data-v3-mobile-trigger\n class=\"sd-sidebar-mobile-v3__icon-action d-flex align-items-center justify-content-center\"\n aria-label=\"M\u1EDF menu\"\n [attr.aria-expanded]=\"isDrawerOpen()\"\n (click)=\"openDrawer($event.currentTarget)\">\n <sd-icon name=\"menu\"></sd-icon>\n </button>\n </header>\n\n <main class=\"flex-1 overflow-auto\">\n <ng-content></ng-content>\n </main>\n\n @if (isDrawerOpen()) {\n <button type=\"button\" class=\"sd-sidebar-mobile-v3__backdrop\" aria-label=\"\u0110\u00F3ng menu\" (click)=\"closeFromBackdrop()\"></button>\n <aside\n class=\"sd-sidebar-mobile-v3__drawer d-flex flex-column bg-white mat-elevation-z8\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Menu ch\u00EDnh\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onDrawerKeydown($event)\">\n <header class=\"d-flex align-items-center justify-content-between gap-8 px-16 py-12 border-bottom border-black200\">\n @if (sidebar().context; as context) {\n <!-- Context switcher (R-008, D-027): trigger ngay d\u01B0\u1EDBi t\u00EAn app; sheet ch\u1ECDn context m\u1EDF trong overlay CDK, ch\u1ED3ng l\u00EAn\n drawer v\u00E0 t\u1EF1 gi\u1EEF Esc (kh\u00F4ng \u0111\u00F3ng drawer). -->\n <div class=\"sd-sidebar-mobile-v3__brand\">\n <span class=\"T18M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n <sd-layout-context-switcher appearance=\"sheet\" [configuration]=\"context\" />\n </div>\n } @else {\n <span class=\"T18M text-ellipsis\">{{ sidebar().defaultTitle || 'Back Office' }}</span>\n }\n <button\n type=\"button\"\n class=\"sd-sidebar-mobile-v3__icon-action d-flex align-items-center justify-content-center\"\n aria-label=\"\u0110\u00F3ng menu\"\n (click)=\"closeFromBackdrop()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </header>\n <div class=\"sd-sidebar-mobile-v3__navigation d-flex flex-column gap-16 flex-1 overflow-auto p-12\">\n <sd-layout-user-menu presentation=\"mobile-inline\" [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n <div class=\"sd-sidebar-mobile-v3__search bg-white\">\n <sd-layout-search-field\n placeholder=\"T\u00ECm trong t\u1EA5t c\u1EA3 menu\"\n [autoId]=\"'layout-v3-mobile-global-search'\"\n [model]=\"searchText()\"\n (sdChange)=\"searchText.set($event)\">\n </sd-layout-search-field>\n </div>\n @if (pinnedMenus().length) {\n <section data-v3-mobile-pinned class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n [menus]=\"pinnedMenus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n @if (recentConfiguration().enabled && recentMenus().length) {\n <section data-v3-mobile-recent class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-layout-menu-tree [menus]=\"recentMenus()\" [activePath]=\"activePath()\" [showPin]=\"false\" (navigate)=\"navigateMenu($event)\">\n </sd-layout-menu-tree>\n </section>\n }\n <section class=\"d-flex flex-column gap-4\">\n <h2 class=\"T12M text-black400 px-12 m-0\">{{ 'core.module.layout.sidebar.all-menu' | sdTranslate }}</h2>\n <sd-layout-menu-tree\n [menus]=\"menus()\"\n [query]=\"searchText()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n pinVisibility=\"always\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\">\n </sd-layout-menu-tree>\n </section>\n </div>\n </aside>\n }\n</div>\n", styles: [":host{display:block}.sd-sidebar-mobile-v3{min-height:100dvh;background:var(--sd-light)}.sd-sidebar-mobile-v3__topbar{min-height:56px}.sd-sidebar-mobile-v3__icon-action{width:40px;height:40px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:var(--sd-black500);cursor:pointer}.sd-sidebar-mobile-v3__icon-action:hover{color:var(--sd-primary);background:var(--sd-primary-light)}.sd-sidebar-mobile-v3__icon-action:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-sidebar-mobile-v3__logo{width:28px;height:28px;object-fit:contain}.sd-sidebar-mobile-v3__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;border:0;background:color-mix(in srgb,var(--sd-black) 40%,transparent)}.sd-sidebar-mobile-v3__drawer{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:0 auto 0 0;width:min(88vw,360px);max-width:100%;padding-bottom:env(safe-area-inset-bottom)}.sd-sidebar-mobile-v3__brand{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.sd-sidebar-mobile-v3__search{position:sticky;z-index:2;top:-12px;margin:-12px;padding:12px;background:var(--sd-white, #fff)}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v3__drawer{transition:none}}\n"] }]
|
|
2632
3432
|
}], ctorParameters: () => [], propDecorators: { trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }] } });
|
|
2633
3433
|
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
3434
|
+
/**
|
|
3435
|
+
* Accent-insensitive V4 search over `menus` (via `searchAvailableMenuLeaves`, so `comingSoon` items and everything under a
|
|
3436
|
+
* `comingSoon` group are left out) with the parent path of every hit. A blank query returns no rows.
|
|
3437
|
+
* The `results` presentation renders exactly this list, so a parent's keyboard index matches the rendered options.
|
|
3438
|
+
*/
|
|
3439
|
+
function buildSidebarV4SearchResults(menus, query) {
|
|
3440
|
+
if (!query?.trim())
|
|
3441
|
+
return [];
|
|
3442
|
+
const paths = collectParentPaths(menus);
|
|
3443
|
+
return searchAvailableMenuLeaves(menus, query).map(menu => ({ key: getMenuStableKey(menu), menu, path: lookupParentPath(paths, menu) }));
|
|
3444
|
+
}
|
|
3445
|
+
const PIN_KEY = 'core.module.layout.menu.pin';
|
|
3446
|
+
const UNPIN_KEY = 'core.module.layout.menu.unpin';
|
|
3447
|
+
const BADGE_PENDING_KEY = 'core.module.layout.sidebar.badge-pending';
|
|
3448
|
+
const RESULT_COUNT_KEY = 'core.module.layout.sidebar.result-count';
|
|
3449
|
+
const NO_MATCH_KEY = 'core.module.layout.sidebar.no-match';
|
|
3450
|
+
const ITEM_RADIUS_VARIABLE = '--sd-sidebar-v4-item-radius';
|
|
3451
|
+
// Mock: panel ở left 58px / top -6px so với ô rail 48px → lệch 10px từ mép phải của nút.
|
|
3452
|
+
const FLYOUT_POSITIONS = [
|
|
3453
|
+
{ originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: 10, offsetY: -6 },
|
|
3454
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: 10, offsetY: 6 },
|
|
3455
|
+
];
|
|
3456
|
+
let nextTreeId = 0;
|
|
3457
|
+
/**
|
|
3458
|
+
* Private menu tree of sidebar V4 (D-014, D-023): imported only by `sd-sidebar-v4` and `sd-sidebar-mobile-v4`, never exported
|
|
3459
|
+
* from a public index. Navigation is the parent's job — the tree only emits.
|
|
3460
|
+
*
|
|
3461
|
+
* Inputs
|
|
3462
|
+
* - `menus`: what to render. `hierarchy`: the full tree; `shortcuts`: the pinned or recent menus; `results`: the full tree
|
|
3463
|
+
* searched with `query` (the rendered options are exactly `results()` / `buildSidebarV4SearchResults(menus, query)`).
|
|
3464
|
+
* - `pathSource`: full tree used for parent paths and the active route when `menus` is a subset (shortcuts); defaults to `menus`.
|
|
3465
|
+
* - `activePath`: current route path; the most exact matching menu is active (`resolveActiveMenuPath`).
|
|
3466
|
+
* - `presentation`: `hierarchy` (sections, groups, branch rails) | `shortcuts` (flat "title · path" rows) | `results` (search).
|
|
3467
|
+
* - `mode`: `expanded` | `collapsed` (72px rail; hierarchy only) | `mobile` (hierarchy with 44px fallbacks, pin always shown).
|
|
3468
|
+
* Row sizes come from `--sd-sidebar-v4-item-height`, `--sd-sidebar-v4-child-height` and `--sd-sidebar-v4-item-radius`
|
|
3469
|
+
* set by the parent (fallbacks 36px / 32px / 999px, or 44px in mobile mode).
|
|
3470
|
+
* - `collapsedGroupKeys` (two-way): stable keys of closed groups — same keys and semantics as the V3 tree.
|
|
3471
|
+
* - `pinnedKeys`, `showPin`: pin toggles on leaf rows (hierarchy) and the unpin toggle on shortcut rows.
|
|
3472
|
+
* - `collapsedGroup`: rail group click opens a flyout (`flyout`) or emits `expandGroup` (`expand`). The flyout closes on
|
|
3473
|
+
* navigation, Escape or a click outside it (that click still reaches its target, e.g. another rail item).
|
|
3474
|
+
* - `query`, `focusedIndex`: search text and the keyboard-selected option of the `results` presentation.
|
|
3475
|
+
*
|
|
3476
|
+
* Outputs: `navigate` (root/leaf rows, never `comingSoon`), `togglePinned`, `expandGroup`.
|
|
3477
|
+
* The host is not a landmark; the parent wraps the tree in its `<nav>`. It always holds a polite live region that announces
|
|
3478
|
+
* the result count (or the no-match message) while the `results` presentation has a query — keep the same tree instance
|
|
3479
|
+
* mounted while switching presentations so the change is announced.
|
|
3480
|
+
* The collapsed rail shows (and announces) only warning/error badges and live status dots; neutral counts stay off the rail.
|
|
3481
|
+
*/
|
|
3482
|
+
class SdSidebarV4MenuTree {
|
|
3483
|
+
#i18n = inject(I18nService);
|
|
3484
|
+
#host = inject(ElementRef);
|
|
3485
|
+
#document = inject(DOCUMENT);
|
|
3486
|
+
#id = `sd-sidebar-v4-menu-tree-${nextTreeId++}`;
|
|
3487
|
+
#flyoutKey = signal(null, /* @ts-ignore */
|
|
3488
|
+
...(ngDevMode ? [{ debugName: "#flyoutKey" }] : /* istanbul ignore next */ []));
|
|
3489
|
+
#flyoutTrigger = null;
|
|
3490
|
+
/** Menus to render; see the class description for what each presentation expects. */
|
|
3491
|
+
menus = input([], /* @ts-ignore */
|
|
2647
3492
|
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
2648
|
-
|
|
3493
|
+
/** Full menu tree for parent paths and the active route when `menus` is a subset; empty means `menus`. */
|
|
3494
|
+
pathSource = input([], /* @ts-ignore */
|
|
3495
|
+
...(ngDevMode ? [{ debugName: "pathSource" }] : /* istanbul ignore next */ []));
|
|
3496
|
+
/** Current route path without query or fragment. */
|
|
3497
|
+
activePath = input('', /* @ts-ignore */
|
|
3498
|
+
...(ngDevMode ? [{ debugName: "activePath" }] : /* istanbul ignore next */ []));
|
|
3499
|
+
presentation = input('hierarchy', /* @ts-ignore */
|
|
3500
|
+
...(ngDevMode ? [{ debugName: "presentation" }] : /* istanbul ignore next */ []));
|
|
3501
|
+
mode = input('expanded', /* @ts-ignore */
|
|
3502
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
3503
|
+
/** Stable keys of closed groups (default: every group open), shared two-way with the parent. */
|
|
3504
|
+
collapsedGroupKeys = model([], /* @ts-ignore */
|
|
3505
|
+
...(ngDevMode ? [{ debugName: "collapsedGroupKeys" }] : /* istanbul ignore next */ []));
|
|
3506
|
+
pinnedKeys = input([], /* @ts-ignore */
|
|
3507
|
+
...(ngDevMode ? [{ debugName: "pinnedKeys" }] : /* istanbul ignore next */ []));
|
|
3508
|
+
showPin = input(true, /* @ts-ignore */
|
|
3509
|
+
...(ngDevMode ? [{ debugName: "showPin" }] : /* istanbul ignore next */ []));
|
|
3510
|
+
/** What a group click does on the collapsed rail. */
|
|
3511
|
+
collapsedGroup = input('flyout', /* @ts-ignore */
|
|
3512
|
+
...(ngDevMode ? [{ debugName: "collapsedGroup" }] : /* istanbul ignore next */ []));
|
|
3513
|
+
/** Search text of the `results` presentation. */
|
|
3514
|
+
query = input('', /* @ts-ignore */
|
|
3515
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
3516
|
+
/** Index in `results()` of the keyboard-selected option; -1 for none. */
|
|
3517
|
+
focusedIndex = input(-1, /* @ts-ignore */
|
|
3518
|
+
...(ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []));
|
|
3519
|
+
/** A root or leaf row was activated (never a `comingSoon` item). */
|
|
3520
|
+
navigate = output();
|
|
3521
|
+
togglePinned = output();
|
|
3522
|
+
/** A rail group was clicked with `collapsedGroup: 'expand'`; the parent expands the sidebar and opens that group. */
|
|
3523
|
+
expandGroup = output();
|
|
3524
|
+
/** Id of the results listbox, for the parent's `aria-controls`. */
|
|
3525
|
+
resultsId = `${this.#id}-results`;
|
|
3526
|
+
resultCountId = `${this.#id}-result-count`;
|
|
3527
|
+
flyoutPositions = FLYOUT_POSITIONS;
|
|
3528
|
+
flyoutKey = this.#flyoutKey.asReadonly();
|
|
3529
|
+
flyoutRadius = signal(null, /* @ts-ignore */
|
|
3530
|
+
...(ngDevMode ? [{ debugName: "flyoutRadius" }] : /* istanbul ignore next */ []));
|
|
3531
|
+
#treeSource = computed(() => (this.pathSource().length ? this.pathSource() : this.menus()), /* @ts-ignore */
|
|
3532
|
+
...(ngDevMode ? [{ debugName: "#treeSource" }] : /* istanbul ignore next */ []));
|
|
3533
|
+
#activeMenuPath = computed(() => resolveActiveMenuPath(this.#treeSource(), this.activePath()), /* @ts-ignore */
|
|
3534
|
+
...(ngDevMode ? [{ debugName: "#activeMenuPath" }] : /* istanbul ignore next */ []));
|
|
3535
|
+
isRail = computed(() => this.presentation() === 'hierarchy' && this.mode() === 'collapsed', /* @ts-ignore */
|
|
3536
|
+
...(ngDevMode ? [{ debugName: "isRail" }] : /* istanbul ignore next */ []));
|
|
3537
|
+
/** Rows of the `results` presentation, in render order. */
|
|
3538
|
+
results = computed(() => buildSidebarV4SearchResults(this.menus(), this.query()), /* @ts-ignore */
|
|
3539
|
+
...(ngDevMode ? [{ debugName: "results" }] : /* istanbul ignore next */ []));
|
|
3540
|
+
sections = computed(() => {
|
|
3541
|
+
const context = this.#nodeContext(new Set(this.collapsedGroupKeys()));
|
|
3542
|
+
return groupMenusBySection(this.menus()).map((group, index) => ({
|
|
3543
|
+
key: group.section === null ? `unsectioned-${index}` : `section-${group.section}`,
|
|
3544
|
+
label: group.section,
|
|
3545
|
+
labelId: `${this.#id}-section-${index}`,
|
|
3546
|
+
separated: group.section === null && index > 0,
|
|
3547
|
+
nodes: this.#collectNodes(group.menus, 0, [], context, []),
|
|
3548
|
+
}));
|
|
3549
|
+
}, /* @ts-ignore */
|
|
3550
|
+
...(ngDevMode ? [{ debugName: "sections" }] : /* istanbul ignore next */ []));
|
|
3551
|
+
shortcuts = computed(() => {
|
|
3552
|
+
const paths = collectParentPaths(this.#treeSource());
|
|
3553
|
+
const activeMenuPath = this.#activeMenuPath();
|
|
3554
|
+
const pinnedKeys = new Set(this.pinnedKeys());
|
|
3555
|
+
return this.menus()
|
|
3556
|
+
.filter((menu) => !!menu && 'path' in menu && typeof menu.path === 'string' && !!menu.path)
|
|
3557
|
+
.map(menu => {
|
|
3558
|
+
const key = getMenuStableKey(menu);
|
|
3559
|
+
const title = menu.title ?? menu.tooltipTitle ?? '';
|
|
3560
|
+
const isPinned = pinnedKeys.has(key);
|
|
3561
|
+
return {
|
|
3562
|
+
menu,
|
|
3563
|
+
key,
|
|
3564
|
+
title,
|
|
3565
|
+
path: lookupParentPath(paths, menu),
|
|
3566
|
+
isActive: menu.path === activeMenuPath,
|
|
3567
|
+
disabled: menu.comingSoon === true,
|
|
3568
|
+
isPinned,
|
|
3569
|
+
pinLabel: this.#i18n.t(isPinned ? UNPIN_KEY : PIN_KEY, { title }),
|
|
3570
|
+
};
|
|
3571
|
+
});
|
|
3572
|
+
}, /* @ts-ignore */
|
|
3573
|
+
...(ngDevMode ? [{ debugName: "shortcuts" }] : /* istanbul ignore next */ []));
|
|
3574
|
+
resultRows = computed(() => {
|
|
3575
|
+
const query = this.query();
|
|
3576
|
+
return this.results().map(result => ({ ...result, segments: highlightSegments(result.menu.title ?? '', query) }));
|
|
3577
|
+
}, /* @ts-ignore */
|
|
3578
|
+
...(ngDevMode ? [{ debugName: "resultRows" }] : /* istanbul ignore next */ []));
|
|
3579
|
+
/** Text of the always-mounted polite live region: the result count, or the no-match message, while searching. */
|
|
3580
|
+
liveMessage = computed(() => {
|
|
3581
|
+
const query = this.query().trim();
|
|
3582
|
+
if (this.presentation() !== 'results' || !query)
|
|
3583
|
+
return '';
|
|
3584
|
+
const count = this.results().length;
|
|
3585
|
+
return count ? this.#i18n.t(RESULT_COUNT_KEY, { count }) : this.#i18n.t(NO_MATCH_KEY, { query });
|
|
3586
|
+
}, /* @ts-ignore */
|
|
3587
|
+
...(ngDevMode ? [{ debugName: "liveMessage" }] : /* istanbul ignore next */ []));
|
|
3588
|
+
railGroups = computed(() => {
|
|
3589
|
+
const activeMenuPath = this.#activeMenuPath();
|
|
3590
|
+
return groupMenusBySection(this.menus()).map((group, groupIndex) => ({
|
|
3591
|
+
key: group.section === null ? `unsectioned-${groupIndex}` : `section-${group.section}`,
|
|
3592
|
+
items: group.menus
|
|
3593
|
+
.map((menu, index) => this.#toRailItem(menu, activeMenuPath, `${this.#id}-rail-${groupIndex}-${index}`))
|
|
3594
|
+
.filter((item) => !!item),
|
|
3595
|
+
}));
|
|
3596
|
+
}, /* @ts-ignore */
|
|
3597
|
+
...(ngDevMode ? [{ debugName: "railGroups" }] : /* istanbul ignore next */ []));
|
|
3598
|
+
flyoutNodes = computed(() => {
|
|
3599
|
+
const key = this.#flyoutKey();
|
|
3600
|
+
if (!key)
|
|
3601
|
+
return [];
|
|
3602
|
+
const item = this.railGroups()
|
|
3603
|
+
.flatMap(group => group.items)
|
|
3604
|
+
.find(candidate => candidate.key === key);
|
|
3605
|
+
if (!item || !('children' in item.menu))
|
|
3606
|
+
return [];
|
|
3607
|
+
// why: flyout luôn bày hết các cấp (bỏ qua collapsedGroupKeys); nhóm lồng thành heading thụt lề.
|
|
3608
|
+
return this.#collectNodes(item.menu.children ?? [], 0, [item.menu.title ?? key], this.#nodeContext(null), []);
|
|
3609
|
+
}, /* @ts-ignore */
|
|
3610
|
+
...(ngDevMode ? [{ debugName: "flyoutNodes" }] : /* istanbul ignore next */ []));
|
|
3611
|
+
constructor() {
|
|
3612
|
+
// why: đổi mode/presentation (vd mở rộng rail) hoặc route đổi từ nơi khác khi flyout đang mở thì đóng hẳn, tránh overlay
|
|
3613
|
+
// mồ côi; không trả focus vì người dùng không chủ động đóng.
|
|
3614
|
+
effect(() => {
|
|
3615
|
+
this.mode();
|
|
3616
|
+
this.presentation();
|
|
3617
|
+
this.collapsedGroup();
|
|
3618
|
+
this.activePath();
|
|
3619
|
+
untracked(() => this.closeFlyout(false));
|
|
3620
|
+
});
|
|
3621
|
+
// why: menus đổi làm group đang mở biến mất (hoặc thành comingSoon) thì bỏ key/trigger cũ thay vì giữ state treo.
|
|
3622
|
+
effect(() => {
|
|
3623
|
+
const key = this.#flyoutKey();
|
|
3624
|
+
if (!key)
|
|
3625
|
+
return;
|
|
3626
|
+
const present = this.railGroups().some(group => group.items.some(item => item.key === key && item.isGroup && !item.disabled));
|
|
3627
|
+
if (!present)
|
|
3628
|
+
untracked(() => this.closeFlyout(false));
|
|
3629
|
+
});
|
|
3630
|
+
}
|
|
3631
|
+
/** Id of the result option at `index`, for the parent's `aria-activedescendant`. */
|
|
3632
|
+
resultOptionId(index) {
|
|
3633
|
+
return `${this.#id}-result-${index}`;
|
|
3634
|
+
}
|
|
3635
|
+
/** Closes the collapsed-rail flyout; focus returns to its group button unless `restoreFocus` is false. */
|
|
3636
|
+
closeFlyout(restoreFocus = true) {
|
|
3637
|
+
if (!this.#flyoutKey())
|
|
3638
|
+
return;
|
|
3639
|
+
const trigger = this.#flyoutTrigger;
|
|
3640
|
+
this.#flyoutKey.set(null);
|
|
3641
|
+
this.#flyoutTrigger = null;
|
|
3642
|
+
if (restoreFocus)
|
|
3643
|
+
trigger?.focus();
|
|
3644
|
+
}
|
|
3645
|
+
onNavigate(menu) {
|
|
3646
|
+
if (menu.comingSoon === true || !('path' in menu))
|
|
3647
|
+
return;
|
|
3648
|
+
this.navigate.emit(menu);
|
|
3649
|
+
}
|
|
3650
|
+
onToggleGroup(node) {
|
|
3651
|
+
if (node.disabled)
|
|
3652
|
+
return;
|
|
3653
|
+
this.collapsedGroupKeys.update(keys => (keys.includes(node.key) ? keys.filter(key => key !== node.key) : [...keys, node.key]));
|
|
3654
|
+
}
|
|
3655
|
+
onTogglePinned(event, menu) {
|
|
3656
|
+
event.stopPropagation();
|
|
3657
|
+
this.togglePinned.emit(menu);
|
|
3658
|
+
}
|
|
3659
|
+
onRailGroup(item, trigger) {
|
|
3660
|
+
if (item.disabled)
|
|
3661
|
+
return;
|
|
3662
|
+
if (this.collapsedGroup() === 'expand') {
|
|
3663
|
+
this.expandGroup.emit(item.menu);
|
|
3664
|
+
return;
|
|
3665
|
+
}
|
|
3666
|
+
if (this.#flyoutKey() === item.key) {
|
|
3667
|
+
this.closeFlyout();
|
|
3668
|
+
return;
|
|
3669
|
+
}
|
|
3670
|
+
this.#flyoutTrigger = trigger;
|
|
3671
|
+
this.flyoutRadius.set(this.#readItemRadius());
|
|
3672
|
+
this.#flyoutKey.set(item.key);
|
|
3673
|
+
}
|
|
3674
|
+
onFlyoutNavigate(node) {
|
|
3675
|
+
if (node.disabled || !('path' in node.menu))
|
|
3676
|
+
return;
|
|
3677
|
+
this.navigate.emit(node.menu);
|
|
3678
|
+
this.closeFlyout();
|
|
3679
|
+
}
|
|
3680
|
+
onFlyoutAttach(overlay) {
|
|
3681
|
+
// why: không dùng cdkTrapFocusAutoCapture — nó nhớ phần tử được focus lúc mở (nút group) và focus lại phần tử đó khi
|
|
3682
|
+
// panel bị huỷ, giành focus của chỗ người dùng vừa click (vd ô input). Tự đưa focus vào panel tại đây; closeFlyout là
|
|
3683
|
+
// nơi duy nhất trả focus. (attach) phát sau khi portal đã render panel nên làm được đồng bộ.
|
|
3684
|
+
const panel = overlay.overlayRef?.overlayElement.querySelector('[data-v4-flyout]');
|
|
3685
|
+
if (!panel)
|
|
3686
|
+
return;
|
|
3687
|
+
(panel.querySelector('button') ?? panel).focus({ preventScroll: true });
|
|
3688
|
+
}
|
|
3689
|
+
onFlyoutKeydown(event) {
|
|
3690
|
+
if (event.key !== 'Escape')
|
|
3691
|
+
return;
|
|
3692
|
+
event.preventDefault();
|
|
3693
|
+
// why: Esc chỉ đóng flyout — không tới handler Esc của lớp ngoài (xoá search, đóng drawer mobile).
|
|
3694
|
+
event.stopPropagation();
|
|
3695
|
+
this.closeFlyout();
|
|
3696
|
+
}
|
|
3697
|
+
onFlyoutOutsideClick() {
|
|
3698
|
+
// why: không dùng backdrop nên click vẫn tới đích (vd mở group rail khác); CDK đã loại click lên chính nút group.
|
|
3699
|
+
// Chỉ trả focus về nút group khi click không trao focus cho phần tử khác (vd ô input trong trang).
|
|
3700
|
+
const active = this.#document.activeElement;
|
|
3701
|
+
const focusIsFree = !active || active === this.#document.body || !!active.closest('[data-v4-flyout]');
|
|
3702
|
+
this.closeFlyout(focusIsFree);
|
|
3703
|
+
}
|
|
3704
|
+
onFlyoutDetach(key) {
|
|
3705
|
+
// why: CDK tự detach (vd scroll strategy) thì đồng bộ lại state; không trả focus vì không do người dùng đóng.
|
|
3706
|
+
if (this.#flyoutKey() !== key)
|
|
3707
|
+
return;
|
|
3708
|
+
this.#flyoutKey.set(null);
|
|
3709
|
+
this.#flyoutTrigger = null;
|
|
3710
|
+
}
|
|
3711
|
+
#nodeContext(collapsedKeys) {
|
|
3712
|
+
return { activeMenuPath: this.#activeMenuPath(), collapsedKeys, pinnedKeys: new Set(this.pinnedKeys()), showPin: this.showPin() };
|
|
3713
|
+
}
|
|
3714
|
+
#collectNodes(menus, depth, ancestors, context, nodes) {
|
|
3715
|
+
for (const menu of menus ?? []) {
|
|
3716
|
+
if (!menu || typeof menu !== 'object')
|
|
3717
|
+
continue;
|
|
3718
|
+
const key = getMenuStableKey(menu, ancestors);
|
|
3719
|
+
if (!key)
|
|
3720
|
+
continue;
|
|
3721
|
+
const children = 'children' in menu && Array.isArray(menu.children) ? menu.children : [];
|
|
3722
|
+
const isGroup = children.length > 0;
|
|
3723
|
+
const path = 'path' in menu && typeof menu.path === 'string' ? menu.path : '';
|
|
3724
|
+
const disabled = menu.comingSoon === true;
|
|
3725
|
+
const title = menu.title ?? menu.tooltipTitle ?? '';
|
|
3726
|
+
const isExpanded = isGroup && !disabled && !context.collapsedKeys?.has(key);
|
|
3727
|
+
const holdsActive = isGroup && !!context.activeMenuPath && containsMenuPath(menu, context.activeMenuPath);
|
|
3728
|
+
const pinnable = context.showPin && !isGroup && !disabled && !!path;
|
|
3729
|
+
const isPinned = context.pinnedKeys.has(key);
|
|
3730
|
+
nodes.push({
|
|
3731
|
+
menu,
|
|
3732
|
+
key,
|
|
3733
|
+
title,
|
|
3734
|
+
depth,
|
|
3735
|
+
isGroup,
|
|
3736
|
+
isExpanded,
|
|
3737
|
+
isActive: !isGroup && !!path && path === context.activeMenuPath,
|
|
3738
|
+
showActiveDot: holdsActive && !isExpanded,
|
|
3739
|
+
disabled,
|
|
3740
|
+
trailing: resolveMenuTrailing(menu),
|
|
3741
|
+
paddingLeft: depth ? 32 + (depth - 1) * 16 : 0,
|
|
3742
|
+
branchOffsets: Array.from({ length: depth }, (_, index) => 21 + index * 16),
|
|
3743
|
+
markerLeft: 20 + Math.max(depth - 1, 0) * 16,
|
|
3744
|
+
pinnable,
|
|
3745
|
+
isPinned,
|
|
3746
|
+
pinLabel: pinnable ? this.#i18n.t(isPinned ? UNPIN_KEY : PIN_KEY, { title }) : '',
|
|
3747
|
+
});
|
|
3748
|
+
if (isExpanded)
|
|
3749
|
+
this.#collectNodes(children, depth + 1, [...ancestors, menu.title ?? key], context, nodes);
|
|
3750
|
+
}
|
|
3751
|
+
return nodes;
|
|
3752
|
+
}
|
|
3753
|
+
#toRailItem(menu, activeMenuPath, descriptionId) {
|
|
3754
|
+
if (!menu || typeof menu !== 'object')
|
|
3755
|
+
return null;
|
|
3756
|
+
const key = getMenuStableKey(menu);
|
|
3757
|
+
if (!key)
|
|
3758
|
+
return null;
|
|
3759
|
+
const isGroup = 'children' in menu && Array.isArray(menu.children) && menu.children.length > 0;
|
|
3760
|
+
const trailing = resolveMenuTrailing(menu);
|
|
3761
|
+
const badge = trailing?.kind === 'badge' ? { value: trailing.value, tone: trailing.tone } : null;
|
|
3762
|
+
const liveTone = trailing?.kind === 'status' && trailing.live ? trailing.tone : null;
|
|
3763
|
+
const description = badge
|
|
3764
|
+
? this.#i18n.t(BADGE_PENDING_KEY, { count: badge.value })
|
|
3765
|
+
: trailing?.kind === 'status' && trailing.live
|
|
3766
|
+
? trailing.label
|
|
3767
|
+
: '';
|
|
3768
|
+
return {
|
|
3769
|
+
menu,
|
|
3770
|
+
key,
|
|
3771
|
+
title: menu.tooltipTitle || menu.title || '',
|
|
3772
|
+
isGroup,
|
|
3773
|
+
isActive: !!activeMenuPath && containsMenuPath(menu, activeMenuPath),
|
|
3774
|
+
disabled: menu.comingSoon === true,
|
|
3775
|
+
badge,
|
|
3776
|
+
liveTone,
|
|
3777
|
+
descriptionId,
|
|
3778
|
+
description,
|
|
3779
|
+
};
|
|
3780
|
+
}
|
|
3781
|
+
#readItemRadius() {
|
|
3782
|
+
// why: flyout nằm trong overlay container của CDK, ngoài host — không thừa kế được biến radius parent khai trên host.
|
|
3783
|
+
const view = this.#document.defaultView;
|
|
3784
|
+
if (!view)
|
|
3785
|
+
return null;
|
|
3786
|
+
return view.getComputedStyle(this.#host.nativeElement).getPropertyValue(ITEM_RADIUS_VARIABLE).trim() || null;
|
|
3787
|
+
}
|
|
3788
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV4MenuTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3789
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV4MenuTree, isStandalone: true, selector: "sd-sidebar-v4-menu-tree", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, pathSource: { classPropertyName: "pathSource", publicName: "pathSource", isSignal: true, isRequired: false, transformFunction: null }, activePath: { classPropertyName: "activePath", publicName: "activePath", isSignal: true, isRequired: false, transformFunction: null }, presentation: { classPropertyName: "presentation", publicName: "presentation", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, collapsedGroupKeys: { classPropertyName: "collapsedGroupKeys", publicName: "collapsedGroupKeys", isSignal: true, isRequired: false, transformFunction: null }, pinnedKeys: { classPropertyName: "pinnedKeys", publicName: "pinnedKeys", isSignal: true, isRequired: false, transformFunction: null }, showPin: { classPropertyName: "showPin", publicName: "showPin", isSignal: true, isRequired: false, transformFunction: null }, collapsedGroup: { classPropertyName: "collapsedGroup", publicName: "collapsedGroup", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, focusedIndex: { classPropertyName: "focusedIndex", publicName: "focusedIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapsedGroupKeys: "collapsedGroupKeysChange", navigate: "navigate", togglePinned: "togglePinned", expandGroup: "expandGroup" }, host: { properties: { "class.sd-sidebar-v4-menu-tree--mobile": "mode() === \"mobile\"", "class.sd-sidebar-v4-menu-tree--collapsed": "isRail()" }, classAttribute: "sd-sidebar-v4-menu-tree" }, ngImport: i0, template: "@let _presentation = presentation();\n<div data-v4-live class=\"sd-sidebar-v4-menu-tree__sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ liveMessage() }}</div>\n@if (_presentation === 'results') {\n @let _query = query().trim();\n @if (_query) {\n @let _rows = resultRows();\n @let _focused = focusedIndex();\n <div data-v4-result-count class=\"sd-sidebar-v4-menu-tree__section-label\" [id]=\"resultCountId\">\n {{ 'core.module.layout.sidebar.result-count' | sdTranslate: { count: _rows.length } }}\n </div>\n @if (_rows.length) {\n <div data-v4-results class=\"sd-sidebar-v4-menu-tree__results\" role=\"listbox\" [id]=\"resultsId\" [attr.aria-labelledby]=\"resultCountId\">\n @for (row of _rows; track $index; let index = $index) {\n <!-- Options stay unfocusable: the parent's search input drives them via aria-activedescendant (Up/Down/Enter); click is the pointer path. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n data-v4-result\n class=\"sd-sidebar-v4-menu-tree__result\"\n role=\"option\"\n [id]=\"resultOptionId(index)\"\n [attr.data-menu-key]=\"row.key\"\n [attr.aria-selected]=\"index === _focused\"\n [class.sd-sidebar-v4-menu-tree__result--focused]=\"index === _focused\"\n (click)=\"onNavigate(row.menu)\">\n <span class=\"sd-sidebar-v4-menu-tree__result-title\">\n @for (segment of row.segments; track $index) {\n <span [class.sd-sidebar-v4-menu-tree__match]=\"segment.match\" [attr.data-v4-match]=\"segment.match ? '' : null\">{{\n segment.text\n }}</span>\n }\n </span>\n @if (row.path) {\n <span data-v4-result-path class=\"sd-sidebar-v4-menu-tree__result-path\">{{ row.path }}</span>\n }\n </div>\n }\n </div>\n } @else {\n <div data-v4-empty class=\"sd-sidebar-v4-menu-tree__empty\">\n {{ 'core.module.layout.sidebar.no-match' | sdTranslate: { query: _query } }}\n </div>\n }\n <div data-v4-search-hint class=\"sd-sidebar-v4-menu-tree__hint\">{{ 'core.module.layout.sidebar.search-hint' | sdTranslate }}</div>\n }\n} @else if (_presentation === 'shortcuts') {\n @for (row of shortcuts(); track row.key) {\n <div\n class=\"sd-sidebar-v4-menu-tree__item sd-sidebar-v4-menu-tree__item--shortcut\"\n [class.sd-sidebar-v4-menu-tree__item--pinnable]=\"showPin()\"\n [attr.data-v4-item]=\"row.key\">\n <button\n type=\"button\"\n data-v4-row=\"shortcut\"\n class=\"sd-sidebar-v4-menu-tree__row sd-sidebar-v4-menu-tree__row--shortcut\"\n [attr.data-menu-key]=\"row.key\"\n [attr.aria-current]=\"row.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"row.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__row--active]=\"row.isActive\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"row.disabled\"\n (click)=\"onNavigate(row.menu)\">\n <span class=\"sd-sidebar-v4-menu-tree__label\">\n {{ row.title }}\n @if (row.path) {\n <span data-v4-shortcut-path class=\"sd-sidebar-v4-menu-tree__shortcut-path\"> \u00B7 {{ row.path }}</span>\n }\n </span>\n @if (row.disabled) {\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: { kind: 'soon' } }\" />\n }\n </button>\n @if (showPin()) {\n <ng-container\n [ngTemplateOutlet]=\"pinTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: row.menu, key: row.key, pinned: row.isPinned, label: row.pinLabel }\" />\n }\n </div>\n }\n} @else if (isRail()) {\n @let _flyoutKey = flyoutKey();\n @let _flyoutMode = collapsedGroup() === 'flyout';\n <div data-v4-rail class=\"sd-sidebar-v4-menu-tree__rail\">\n @for (group of railGroups(); track group.key; let first = $first) {\n @if (!first) {\n <div data-v4-rail-separator class=\"sd-sidebar-v4-menu-tree__rail-separator\" aria-hidden=\"true\"></div>\n }\n @for (item of group.items; track item.key) {\n <div class=\"sd-sidebar-v4-menu-tree__rail-cell\" [attr.data-v4-rail-cell]=\"item.key\">\n @if (item.isGroup) {\n <button\n #railGroupButton\n cdkOverlayOrigin\n #flyoutOrigin=\"cdkOverlayOrigin\"\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__rail-item\"\n [attr.data-v4-rail-item]=\"item.key\"\n [attr.title]=\"item.title\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-describedby]=\"item.description ? item.descriptionId : null\"\n [attr.aria-haspopup]=\"_flyoutMode && !item.disabled ? 'dialog' : null\"\n [attr.aria-expanded]=\"_flyoutMode && !item.disabled ? _flyoutKey === item.key : null\"\n [attr.aria-disabled]=\"item.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__rail-item--active]=\"item.isActive\"\n [class.sd-sidebar-v4-menu-tree__rail-item--open]=\"_flyoutKey === item.key\"\n [class.sd-sidebar-v4-menu-tree__rail-item--disabled]=\"item.disabled\"\n (click)=\"onRailGroup(item, railGroupButton)\">\n <ng-container [ngTemplateOutlet]=\"railContent\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </button>\n <ng-template\n cdkConnectedOverlay\n #flyoutOverlay=\"cdkConnectedOverlay\"\n [cdkConnectedOverlayOrigin]=\"flyoutOrigin\"\n [cdkConnectedOverlayOpen]=\"_flyoutKey === item.key\"\n [cdkConnectedOverlayPositions]=\"flyoutPositions\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayFlexibleDimensions]=\"false\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayHasBackdrop]=\"false\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n (overlayOutsideClick)=\"onFlyoutOutsideClick()\"\n (overlayKeydown)=\"onFlyoutKeydown($event)\"\n (attach)=\"onFlyoutAttach(flyoutOverlay)\"\n (detach)=\"onFlyoutDetach(item.key)\">\n <div\n data-v4-flyout\n class=\"sd-sidebar-v4-menu-tree__flyout\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-label]=\"item.title\"\n [style.--sd-sidebar-v4-item-radius]=\"flyoutRadius()\"\n cdkTrapFocus>\n <div data-v4-flyout-title class=\"sd-sidebar-v4-menu-tree__flyout-title\">{{ item.title }}</div>\n @for (node of flyoutNodes(); track node.key) {\n @if (node.isGroup) {\n <div\n data-v4-flyout-heading\n class=\"sd-sidebar-v4-menu-tree__flyout-heading\"\n [class.sd-sidebar-v4-menu-tree__flyout-heading--disabled]=\"node.disabled\"\n [style.padding-left.px]=\"12 + node.depth * 16\">\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n </div>\n } @else {\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__row sd-sidebar-v4-menu-tree__row--flyout\"\n [attr.data-v4-flyout-item]=\"node.key\"\n [attr.aria-current]=\"node.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"node.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__row--active]=\"node.isActive\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"node.disabled\"\n [style.padding-left.px]=\"12 + node.depth * 16\"\n (click)=\"onFlyoutNavigate(node)\">\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n </button>\n }\n }\n </div>\n </ng-template>\n } @else {\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__rail-item\"\n [attr.data-v4-rail-item]=\"item.key\"\n [attr.title]=\"item.title\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-describedby]=\"item.description ? item.descriptionId : null\"\n [attr.aria-current]=\"item.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"item.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__rail-item--active]=\"item.isActive\"\n [class.sd-sidebar-v4-menu-tree__rail-item--disabled]=\"item.disabled\"\n (click)=\"onNavigate(item.menu)\">\n <ng-container [ngTemplateOutlet]=\"railContent\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </button>\n }\n @if (item.description) {\n <span hidden [id]=\"item.descriptionId\">{{ item.description }}</span>\n }\n </div>\n }\n }\n </div>\n} @else {\n @for (section of sections(); track section.key) {\n <div\n class=\"sd-sidebar-v4-menu-tree__section\"\n [attr.data-v4-section]=\"section.label ?? ''\"\n [attr.role]=\"section.label ? 'group' : null\"\n [attr.aria-labelledby]=\"section.label ? section.labelId : null\"\n [class.sd-sidebar-v4-menu-tree__section--separated]=\"section.separated\">\n @if (section.label) {\n <div data-v4-section-label class=\"sd-sidebar-v4-menu-tree__section-label\" [id]=\"section.labelId\">{{ section.label }}</div>\n }\n @for (node of section.nodes; track node.key) {\n <div\n class=\"sd-sidebar-v4-menu-tree__item\"\n [class.sd-sidebar-v4-menu-tree__item--nested]=\"node.depth > 0\"\n [class.sd-sidebar-v4-menu-tree__item--pinnable]=\"node.pinnable\"\n [attr.data-v4-item]=\"node.key\"\n [style.padding-left.px]=\"node.depth ? node.paddingLeft : null\">\n @for (offset of node.branchOffsets; track offset) {\n <span data-menu-branch class=\"sd-sidebar-v4-menu-tree__branch\" [style.left.px]=\"offset\" aria-hidden=\"true\"></span>\n }\n @if (node.isActive && node.depth > 0) {\n <span data-v4-marker class=\"sd-sidebar-v4-menu-tree__marker\" [style.left.px]=\"node.markerLeft\" aria-hidden=\"true\"></span>\n }\n @if (node.isGroup) {\n <button\n type=\"button\"\n data-v4-row=\"group\"\n class=\"sd-sidebar-v4-menu-tree__row sd-sidebar-v4-menu-tree__row--group\"\n [class.sd-sidebar-v4-menu-tree__row--child]=\"node.depth > 0\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"node.disabled\"\n [attr.data-menu-group]=\"node.key\"\n [attr.aria-expanded]=\"node.disabled ? null : node.isExpanded\"\n [attr.aria-disabled]=\"node.disabled || null\"\n (click)=\"onToggleGroup(node)\">\n @if (node.depth === 0) {\n <ng-container\n [ngTemplateOutlet]=\"menuIcon\"\n [ngTemplateOutletContext]=\"{ $implicit: node.menu, filled: false, group: true }\" />\n }\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n @if (node.showActiveDot) {\n <span data-v4-active-dot class=\"sd-sidebar-v4-menu-tree__dot\" aria-hidden=\"true\"></span>\n }\n @if (!node.disabled) {\n <sd-icon\n data-v4-chevron\n class=\"sd-sidebar-v4-menu-tree__chevron\"\n [name]=\"node.isExpanded ? 'expand_less' : 'expand_more'\"\n size=\"20px\"></sd-icon>\n }\n </button>\n } @else {\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__row\"\n [class.sd-sidebar-v4-menu-tree__row--child]=\"node.depth > 0\"\n [class.sd-sidebar-v4-menu-tree__row--active]=\"node.isActive\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"node.disabled\"\n [attr.data-v4-row]=\"node.depth ? 'child' : 'root'\"\n [attr.data-menu-key]=\"node.key\"\n [attr.aria-current]=\"node.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"node.disabled || null\"\n (click)=\"onNavigate(node.menu)\">\n @if (node.depth === 0) {\n <ng-container\n [ngTemplateOutlet]=\"menuIcon\"\n [ngTemplateOutletContext]=\"{ $implicit: node.menu, filled: node.isActive, group: false }\" />\n }\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n </button>\n @if (node.pinnable) {\n <ng-container\n [ngTemplateOutlet]=\"pinTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: node.menu, key: node.key, pinned: node.isPinned, label: node.pinLabel }\" />\n }\n }\n </div>\n }\n </div>\n }\n}\n\n<ng-template #menuIcon let-menu let-filled=\"filled\" let-group=\"group\">\n @if (menu.iconUrl) {\n <img data-menu-icon class=\"sd-sidebar-v4-menu-tree__icon-image\" [src]=\"menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon\n data-menu-icon\n class=\"sd-sidebar-v4-menu-tree__icon\"\n [name]=\"menu.icon || (group ? 'folder' : 'chevron_right')\"\n [fontSet]=\"filled ? 'material-icons' : 'material-icons-outlined'\"\n size=\"20px\"></sd-icon>\n }\n</ng-template>\n\n<ng-template #railContent let-item>\n <ng-container\n [ngTemplateOutlet]=\"menuIcon\"\n [ngTemplateOutletContext]=\"{ $implicit: item.menu, filled: item.isActive, group: item.isGroup }\" />\n @if (item.badge) {\n <span\n data-v4-rail-badge\n class=\"sd-sidebar-v4-menu-tree__rail-badge\"\n [class.sd-sidebar-v4-menu-tree__badge--warning]=\"item.badge.tone === 'warning'\"\n [class.sd-sidebar-v4-menu-tree__badge--error]=\"item.badge.tone === 'error'\"\n aria-hidden=\"true\">\n {{ item.badge.value }}\n </span>\n } @else if (item.liveTone) {\n <span data-v4-rail-live class=\"sd-sidebar-v4-menu-tree__rail-live\" [attr.data-tone]=\"item.liveTone\" aria-hidden=\"true\"></span>\n }\n</ng-template>\n\n<ng-template #trailingTemplate let-trailing>\n @switch (trailing?.kind) {\n @case ('soon') {\n <span data-v4-trailing=\"soon\" class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__chip\">\n {{ 'core.module.layout.sidebar.coming-soon' | sdTranslate }}\n </span>\n }\n @case ('count') {\n <span data-v4-trailing=\"count\" class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__count\">{{ trailing.value }}</span>\n }\n @case ('badge') {\n <span\n data-v4-trailing=\"badge\"\n class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__badge\"\n [class.sd-sidebar-v4-menu-tree__badge--warning]=\"trailing.tone === 'warning'\"\n [class.sd-sidebar-v4-menu-tree__badge--error]=\"trailing.tone === 'error'\"\n role=\"img\"\n [attr.aria-label]=\"'core.module.layout.sidebar.badge-pending' | sdTranslate: { count: trailing.value }\">\n {{ trailing.value }}\n </span>\n }\n @case ('status') {\n <span\n data-v4-trailing=\"status\"\n class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__status\"\n [attr.data-tone]=\"trailing.tone\">\n <span\n data-v4-status-dot\n class=\"sd-sidebar-v4-menu-tree__status-dot\"\n [class.sd-sidebar-v4-menu-tree__status-dot--live]=\"trailing.live\"\n aria-hidden=\"true\"></span>\n {{ trailing.label }}\n </span>\n }\n }\n</ng-template>\n\n<ng-template #pinTemplate let-menu let-key=\"key\" let-pinned=\"pinned\" let-label=\"label\">\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__pin\"\n [attr.data-pin-key]=\"key\"\n [attr.aria-label]=\"label\"\n [attr.aria-pressed]=\"pinned\"\n (click)=\"onTogglePinned($event, menu)\">\n <sd-icon name=\"push_pin\" [fontSet]=\"pinned ? 'material-icons' : 'material-icons-outlined'\" size=\"18px\"></sd-icon>\n </button>\n</ng-template>\n", styles: [":host{--tree-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--tree-active-bg: var(--sd-sidebar-v4-active-bg, var(--sd-primary-light));--tree-active-ink: var(--sd-sidebar-v4-active-ink, var(--sd-primary));--tree-active-shadow: var(--sd-sidebar-v4-active-shadow, none);--tree-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--tree-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--tree-branch: color-mix(in srgb, var(--sd-border) 60%, var(--sd-surface));--tree-attention: var(--sd-sidebar-v4-attention, var(--sd-warning));--tree-live: var(--sd-sidebar-v4-live, var(--sd-success));--tree-muted-ink: var(--sd-text-secondary);--tree-disabled-ink: var(--sd-disabled-text, color-mix(in srgb, var(--sd-text) 60%, transparent));--tree-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));--tree-radius: var(--sd-sidebar-v4-item-radius, var(--sd-radius-999, 999px));--tree-row-height: var(--sd-sidebar-v4-item-height, 36px);--tree-child-height: var(--sd-sidebar-v4-child-height, 32px);display:block;min-width:0;color:var(--sd-text)}:host(.sd-sidebar-v4-menu-tree--mobile){--tree-row-height: var(--sd-sidebar-v4-item-height, 44px);--tree-child-height: var(--sd-sidebar-v4-child-height, 44px)}:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__pin{position:static;flex:0 0 44px;align-self:center;width:44px;height:44px;transform:none;opacity:1;pointer-events:auto}:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable>.sd-sidebar-v4-menu-tree__row,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row{padding-right:var(--sd-space-12, 12px)}:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing{visibility:visible}.sd-sidebar-v4-menu-tree__sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.sd-sidebar-v4-menu-tree__section--separated{margin-top:var(--sd-space-16, 16px)}.sd-sidebar-v4-menu-tree__section-label{padding:14px 12px 4px;color:var(--tree-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-sidebar-v4-menu-tree__item{position:relative;display:flex;align-items:stretch;min-width:0}.sd-sidebar-v4-menu-tree__row{display:flex;flex:1 1 auto;align-items:center;gap:var(--sd-space-12, 12px);box-sizing:border-box;width:100%;min-width:0;min-height:var(--tree-row-height, 36px);margin:0;padding:0 var(--sd-space-12, 12px);border:0;border-radius:var(--tree-radius, 999px);background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-20, 20px);text-align:left;cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__row:hover{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__row--group{padding:0 var(--sd-space-8, 8px) 0 var(--sd-space-12, 12px)}.sd-sidebar-v4-menu-tree__row--child{gap:var(--sd-space-8, 8px);min-height:var(--tree-child-height, 32px)}.sd-sidebar-v4-menu-tree__row--active,.sd-sidebar-v4-menu-tree__row--active:hover{background:var(--tree-active-bg);box-shadow:var(--tree-active-shadow);color:var(--tree-active-ink);font-weight:var(--sd-font-weight-medium, 500)}.sd-sidebar-v4-menu-tree__row--disabled,.sd-sidebar-v4-menu-tree__row--disabled:hover{background:transparent;color:var(--tree-disabled-ink);cursor:not-allowed}.sd-sidebar-v4-menu-tree__row:focus-visible{outline:none;box-shadow:var(--tree-focus-ring)}.sd-sidebar-v4-menu-tree__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__icon-image{flex:0 0 20px;width:20px;height:20px;color:var(--tree-muted-ink)}.sd-sidebar-v4-menu-tree__icon-image{object-fit:contain}.sd-sidebar-v4-menu-tree__row--active .sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__rail-item--active .sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__row--disabled .sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__rail-item--disabled .sd-sidebar-v4-menu-tree__icon{color:inherit}.sd-sidebar-v4-menu-tree__row--disabled .sd-sidebar-v4-menu-tree__icon-image,.sd-sidebar-v4-menu-tree__rail-item--disabled .sd-sidebar-v4-menu-tree__icon-image{opacity:.6}.sd-sidebar-v4-menu-tree__chevron{flex:0 0 20px;color:var(--tree-muted-ink)}.sd-sidebar-v4-menu-tree__dot{flex:none;width:6px;height:6px;border-radius:3px;background:var(--sd-primary)}.sd-sidebar-v4-menu-tree__item--nested{min-height:var(--tree-child-height, 32px);animation:sd-sidebar-v4-expand-in .16s ease-out}@keyframes sd-sidebar-v4-expand-in{0%{opacity:0}}.sd-sidebar-v4-menu-tree__branch{position:absolute;top:0;bottom:0;width:1px;background:var(--tree-branch);pointer-events:none}.sd-sidebar-v4-menu-tree__marker{position:absolute;z-index:1;top:7px;bottom:7px;width:3px;border-radius:var(--sd-radius-2, 2px);background:var(--sd-primary);pointer-events:none}.sd-sidebar-v4-menu-tree__trailing{flex:none}.sd-sidebar-v4-menu-tree__count{color:var(--tree-muted-ink);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__row--active .sd-sidebar-v4-menu-tree__count{color:inherit}.sd-sidebar-v4-menu-tree__badge,.sd-sidebar-v4-menu-tree__rail-badge{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-weight:var(--sd-font-weight-medium, 500);line-height:1}.sd-sidebar-v4-menu-tree__badge{min-width:20px;height:20px;padding:0 6px;border-radius:var(--sd-radius-10, 10px);font-size:11.5px}.sd-sidebar-v4-menu-tree__badge--warning{background:var(--tree-attention);color:var(--sd-warning-contrast)}.sd-sidebar-v4-menu-tree__badge--error{background:var(--sd-error);color:var(--sd-error-contrast)}.sd-sidebar-v4-menu-tree__status,.sd-sidebar-v4-menu-tree__rail-live{--tree-tone: var(--tree-live)}.sd-sidebar-v4-menu-tree__status[data-tone=warning],.sd-sidebar-v4-menu-tree__rail-live[data-tone=warning]{--tree-tone: var(--sd-warning)}.sd-sidebar-v4-menu-tree__status[data-tone=error],.sd-sidebar-v4-menu-tree__rail-live[data-tone=error]{--tree-tone: var(--sd-error)}.sd-sidebar-v4-menu-tree__status{display:inline-flex;align-items:center;gap:6px;color:var(--tree-tone);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__status-dot{flex:none;width:6px;height:6px;border-radius:3px;background:var(--tree-tone)}.sd-sidebar-v4-menu-tree__status-dot--live{box-shadow:0 0 0 3px color-mix(in srgb,var(--tree-tone) 18%,transparent)}.sd-sidebar-v4-menu-tree__chip{padding:0 7px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-999, 999px);color:var(--tree-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-18, 18px)}.sd-sidebar-v4-menu-tree__pin{position:absolute;top:50%;right:2px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;margin:0;padding:0;border:0;border-radius:var(--tree-radius, 999px);background:transparent;color:var(--tree-muted-ink);cursor:pointer;opacity:0;pointer-events:none;transform:translateY(-50%);transition:opacity var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__pin:hover{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__pin:focus-visible{outline:none;box-shadow:var(--tree-focus-ring)}.sd-sidebar-v4-menu-tree__item:hover>.sd-sidebar-v4-menu-tree__pin,.sd-sidebar-v4-menu-tree__pin:focus-visible,.sd-sidebar-v4-menu-tree__item--shortcut>.sd-sidebar-v4-menu-tree__pin{opacity:1;pointer-events:auto}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row{padding-right:40px}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing{visibility:hidden}.sd-sidebar-v4-menu-tree__row--shortcut{gap:var(--sd-space-8, 8px)}.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row{padding-right:40px}.sd-sidebar-v4-menu-tree__shortcut-path{color:var(--tree-muted-ink);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-regular, 400)}.sd-sidebar-v4-menu-tree__results{display:flex;flex-direction:column}.sd-sidebar-v4-menu-tree__result{display:flex;flex-direction:column;justify-content:center;box-sizing:border-box;min-height:var(--tree-row-height, 36px);padding:6px var(--sd-space-12, 12px);border-radius:var(--sd-radius-16, 16px);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__result:hover{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__result--focused,.sd-sidebar-v4-menu-tree__result--focused:hover{background:var(--sd-surface);box-shadow:inset 0 0 0 2px var(--sd-primary)}.sd-sidebar-v4-menu-tree__result-title{color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);overflow-wrap:anywhere}.sd-sidebar-v4-menu-tree__match{border-radius:3px;background:var(--sd-primary-light);color:var(--sd-primary-dark);font-weight:var(--sd-font-weight-medium, 500)}.sd-sidebar-v4-menu-tree__result-path{margin-top:1px;color:var(--tree-muted-ink);font-size:11.5px;line-height:var(--sd-line-height-16, 16px);overflow-wrap:anywhere}.sd-sidebar-v4-menu-tree__empty{padding:var(--sd-space-16, 16px) var(--sd-space-12, 12px);color:var(--tree-muted-ink);font-size:var(--sd-font-size-13, 13px);overflow-wrap:anywhere}.sd-sidebar-v4-menu-tree__hint{padding:var(--sd-space-12, 12px) var(--sd-space-12, 12px) 0;color:var(--tree-muted-ink);font-size:11.5px;line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__rail{display:flex;flex-direction:column;align-items:center;gap:var(--sd-space-4, 4px)}.sd-sidebar-v4-menu-tree__rail-cell{position:relative;display:flex}.sd-sidebar-v4-menu-tree__rail-item{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:48px;height:36px;margin:0;padding:0;border:0;border-radius:var(--tree-radius, 999px);background:transparent;color:var(--tree-muted-ink);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__rail-item:hover,.sd-sidebar-v4-menu-tree__rail-item.sd-sidebar-v4-menu-tree__rail-item--open{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__rail-item--active,.sd-sidebar-v4-menu-tree__rail-item--active:hover{background:var(--tree-active-bg);box-shadow:var(--tree-active-shadow);color:var(--tree-active-ink)}.sd-sidebar-v4-menu-tree__rail-item--disabled,.sd-sidebar-v4-menu-tree__rail-item--disabled:hover{background:transparent;color:var(--tree-disabled-ink);cursor:not-allowed}.sd-sidebar-v4-menu-tree__rail-item:focus-visible{outline:none;box-shadow:var(--tree-focus-ring)}.sd-sidebar-v4-menu-tree__rail-separator{flex:none;width:32px;height:1px;margin:5px 0;background:var(--tree-line)}.sd-sidebar-v4-menu-tree__rail-badge{position:absolute;top:0;right:2px;min-width:16px;height:16px;padding:0 4px;border-radius:var(--sd-radius-8, 8px);font-size:var(--sd-font-size-10, 10px);box-shadow:0 0 0 2px var(--tree-bg);pointer-events:none}.sd-sidebar-v4-menu-tree__rail-live{position:absolute;top:5px;right:9px;width:8px;height:8px;border-radius:var(--sd-radius-4, 4px);background:var(--tree-tone);box-shadow:0 0 0 2px var(--tree-bg);pointer-events:none}.sd-sidebar-v4-menu-tree__flyout{--tree-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--tree-active-bg: var(--sd-sidebar-v4-active-bg, var(--sd-primary-light));--tree-active-ink: var(--sd-sidebar-v4-active-ink, var(--sd-primary));--tree-active-shadow: var(--sd-sidebar-v4-active-shadow, none);--tree-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--tree-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--tree-branch: color-mix(in srgb, var(--sd-border) 60%, var(--sd-surface));--tree-attention: var(--sd-sidebar-v4-attention, var(--sd-warning));--tree-live: var(--sd-sidebar-v4-live, var(--sd-success));--tree-muted-ink: var(--sd-text-secondary);--tree-disabled-ink: var(--sd-disabled-text, color-mix(in srgb, var(--sd-text) 60%, transparent));--tree-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));--tree-radius: var(--sd-sidebar-v4-item-radius, var(--sd-radius-999, 999px));--tree-row-height: var(--sd-sidebar-v4-item-height, 36px);--tree-child-height: var(--sd-sidebar-v4-child-height, 32px);box-sizing:border-box;width:232px;padding:var(--sd-space-8, 8px);border:1px solid var(--tree-line);border-radius:var(--sd-radius-16, 16px);background:var(--sd-surface);color:var(--sd-text);box-shadow:0 6px 24px color-mix(in srgb,var(--sd-text) 14%,transparent);animation:sd-sidebar-v4-flyout-in .14s ease-out}.sd-sidebar-v4-menu-tree__flyout:focus{outline:none}.sd-sidebar-v4-menu-tree__flyout-title{padding:6px var(--sd-space-12, 12px);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-20, 20px)}.sd-sidebar-v4-menu-tree__flyout-heading{display:flex;align-items:center;gap:var(--sd-space-8, 8px);padding:6px var(--sd-space-12, 12px) 2px;color:var(--tree-muted-ink);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__flyout-heading--disabled{color:var(--tree-disabled-ink)}.sd-sidebar-v4-menu-tree__row--flyout{gap:var(--sd-space-8, 8px);height:32px;min-height:32px}@keyframes sd-sidebar-v4-flyout-in{0%{opacity:0;transform:translate(-4px)}}@media(pointer:coarse){.sd-sidebar-v4-menu-tree__row{min-height:max(44px,var(--tree-row-height, 36px))}.sd-sidebar-v4-menu-tree__row--child{min-height:max(44px,var(--tree-child-height, 32px))}.sd-sidebar-v4-menu-tree__result{min-height:max(44px,var(--tree-row-height, 36px))}.sd-sidebar-v4-menu-tree__row--flyout{height:auto;min-height:44px}.sd-sidebar-v4-menu-tree__rail-item{height:44px}.sd-sidebar-v4-menu-tree__pin{position:static;flex:0 0 44px;align-self:center;width:44px;height:44px;transform:none;opacity:1;pointer-events:auto}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row{padding-right:var(--sd-space-12, 12px)}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing{visibility:visible}}@media(prefers-reduced-motion:reduce){.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__pin,.sd-sidebar-v4-menu-tree__result,.sd-sidebar-v4-menu-tree__rail-item{transition:none}.sd-sidebar-v4-menu-tree__flyout,.sd-sidebar-v4-menu-tree__item--nested{animation:none}}\n"], dependencies: [{ kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3790
|
+
}
|
|
3791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV4MenuTree, decorators: [{
|
|
3792
|
+
type: Component,
|
|
3793
|
+
args: [{ selector: 'sd-sidebar-v4-menu-tree', standalone: true, imports: [CdkConnectedOverlay, CdkOverlayOrigin, CdkTrapFocus, NgTemplateOutlet, SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
3794
|
+
class: 'sd-sidebar-v4-menu-tree',
|
|
3795
|
+
'[class.sd-sidebar-v4-menu-tree--mobile]': 'mode() === "mobile"',
|
|
3796
|
+
'[class.sd-sidebar-v4-menu-tree--collapsed]': 'isRail()',
|
|
3797
|
+
}, template: "@let _presentation = presentation();\n<div data-v4-live class=\"sd-sidebar-v4-menu-tree__sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ liveMessage() }}</div>\n@if (_presentation === 'results') {\n @let _query = query().trim();\n @if (_query) {\n @let _rows = resultRows();\n @let _focused = focusedIndex();\n <div data-v4-result-count class=\"sd-sidebar-v4-menu-tree__section-label\" [id]=\"resultCountId\">\n {{ 'core.module.layout.sidebar.result-count' | sdTranslate: { count: _rows.length } }}\n </div>\n @if (_rows.length) {\n <div data-v4-results class=\"sd-sidebar-v4-menu-tree__results\" role=\"listbox\" [id]=\"resultsId\" [attr.aria-labelledby]=\"resultCountId\">\n @for (row of _rows; track $index; let index = $index) {\n <!-- Options stay unfocusable: the parent's search input drives them via aria-activedescendant (Up/Down/Enter); click is the pointer path. -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n data-v4-result\n class=\"sd-sidebar-v4-menu-tree__result\"\n role=\"option\"\n [id]=\"resultOptionId(index)\"\n [attr.data-menu-key]=\"row.key\"\n [attr.aria-selected]=\"index === _focused\"\n [class.sd-sidebar-v4-menu-tree__result--focused]=\"index === _focused\"\n (click)=\"onNavigate(row.menu)\">\n <span class=\"sd-sidebar-v4-menu-tree__result-title\">\n @for (segment of row.segments; track $index) {\n <span [class.sd-sidebar-v4-menu-tree__match]=\"segment.match\" [attr.data-v4-match]=\"segment.match ? '' : null\">{{\n segment.text\n }}</span>\n }\n </span>\n @if (row.path) {\n <span data-v4-result-path class=\"sd-sidebar-v4-menu-tree__result-path\">{{ row.path }}</span>\n }\n </div>\n }\n </div>\n } @else {\n <div data-v4-empty class=\"sd-sidebar-v4-menu-tree__empty\">\n {{ 'core.module.layout.sidebar.no-match' | sdTranslate: { query: _query } }}\n </div>\n }\n <div data-v4-search-hint class=\"sd-sidebar-v4-menu-tree__hint\">{{ 'core.module.layout.sidebar.search-hint' | sdTranslate }}</div>\n }\n} @else if (_presentation === 'shortcuts') {\n @for (row of shortcuts(); track row.key) {\n <div\n class=\"sd-sidebar-v4-menu-tree__item sd-sidebar-v4-menu-tree__item--shortcut\"\n [class.sd-sidebar-v4-menu-tree__item--pinnable]=\"showPin()\"\n [attr.data-v4-item]=\"row.key\">\n <button\n type=\"button\"\n data-v4-row=\"shortcut\"\n class=\"sd-sidebar-v4-menu-tree__row sd-sidebar-v4-menu-tree__row--shortcut\"\n [attr.data-menu-key]=\"row.key\"\n [attr.aria-current]=\"row.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"row.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__row--active]=\"row.isActive\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"row.disabled\"\n (click)=\"onNavigate(row.menu)\">\n <span class=\"sd-sidebar-v4-menu-tree__label\">\n {{ row.title }}\n @if (row.path) {\n <span data-v4-shortcut-path class=\"sd-sidebar-v4-menu-tree__shortcut-path\"> \u00B7 {{ row.path }}</span>\n }\n </span>\n @if (row.disabled) {\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: { kind: 'soon' } }\" />\n }\n </button>\n @if (showPin()) {\n <ng-container\n [ngTemplateOutlet]=\"pinTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: row.menu, key: row.key, pinned: row.isPinned, label: row.pinLabel }\" />\n }\n </div>\n }\n} @else if (isRail()) {\n @let _flyoutKey = flyoutKey();\n @let _flyoutMode = collapsedGroup() === 'flyout';\n <div data-v4-rail class=\"sd-sidebar-v4-menu-tree__rail\">\n @for (group of railGroups(); track group.key; let first = $first) {\n @if (!first) {\n <div data-v4-rail-separator class=\"sd-sidebar-v4-menu-tree__rail-separator\" aria-hidden=\"true\"></div>\n }\n @for (item of group.items; track item.key) {\n <div class=\"sd-sidebar-v4-menu-tree__rail-cell\" [attr.data-v4-rail-cell]=\"item.key\">\n @if (item.isGroup) {\n <button\n #railGroupButton\n cdkOverlayOrigin\n #flyoutOrigin=\"cdkOverlayOrigin\"\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__rail-item\"\n [attr.data-v4-rail-item]=\"item.key\"\n [attr.title]=\"item.title\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-describedby]=\"item.description ? item.descriptionId : null\"\n [attr.aria-haspopup]=\"_flyoutMode && !item.disabled ? 'dialog' : null\"\n [attr.aria-expanded]=\"_flyoutMode && !item.disabled ? _flyoutKey === item.key : null\"\n [attr.aria-disabled]=\"item.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__rail-item--active]=\"item.isActive\"\n [class.sd-sidebar-v4-menu-tree__rail-item--open]=\"_flyoutKey === item.key\"\n [class.sd-sidebar-v4-menu-tree__rail-item--disabled]=\"item.disabled\"\n (click)=\"onRailGroup(item, railGroupButton)\">\n <ng-container [ngTemplateOutlet]=\"railContent\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </button>\n <ng-template\n cdkConnectedOverlay\n #flyoutOverlay=\"cdkConnectedOverlay\"\n [cdkConnectedOverlayOrigin]=\"flyoutOrigin\"\n [cdkConnectedOverlayOpen]=\"_flyoutKey === item.key\"\n [cdkConnectedOverlayPositions]=\"flyoutPositions\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayFlexibleDimensions]=\"false\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayHasBackdrop]=\"false\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n (overlayOutsideClick)=\"onFlyoutOutsideClick()\"\n (overlayKeydown)=\"onFlyoutKeydown($event)\"\n (attach)=\"onFlyoutAttach(flyoutOverlay)\"\n (detach)=\"onFlyoutDetach(item.key)\">\n <div\n data-v4-flyout\n class=\"sd-sidebar-v4-menu-tree__flyout\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-label]=\"item.title\"\n [style.--sd-sidebar-v4-item-radius]=\"flyoutRadius()\"\n cdkTrapFocus>\n <div data-v4-flyout-title class=\"sd-sidebar-v4-menu-tree__flyout-title\">{{ item.title }}</div>\n @for (node of flyoutNodes(); track node.key) {\n @if (node.isGroup) {\n <div\n data-v4-flyout-heading\n class=\"sd-sidebar-v4-menu-tree__flyout-heading\"\n [class.sd-sidebar-v4-menu-tree__flyout-heading--disabled]=\"node.disabled\"\n [style.padding-left.px]=\"12 + node.depth * 16\">\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n </div>\n } @else {\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__row sd-sidebar-v4-menu-tree__row--flyout\"\n [attr.data-v4-flyout-item]=\"node.key\"\n [attr.aria-current]=\"node.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"node.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__row--active]=\"node.isActive\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"node.disabled\"\n [style.padding-left.px]=\"12 + node.depth * 16\"\n (click)=\"onFlyoutNavigate(node)\">\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n </button>\n }\n }\n </div>\n </ng-template>\n } @else {\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__rail-item\"\n [attr.data-v4-rail-item]=\"item.key\"\n [attr.title]=\"item.title\"\n [attr.aria-label]=\"item.title\"\n [attr.aria-describedby]=\"item.description ? item.descriptionId : null\"\n [attr.aria-current]=\"item.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"item.disabled || null\"\n [class.sd-sidebar-v4-menu-tree__rail-item--active]=\"item.isActive\"\n [class.sd-sidebar-v4-menu-tree__rail-item--disabled]=\"item.disabled\"\n (click)=\"onNavigate(item.menu)\">\n <ng-container [ngTemplateOutlet]=\"railContent\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </button>\n }\n @if (item.description) {\n <span hidden [id]=\"item.descriptionId\">{{ item.description }}</span>\n }\n </div>\n }\n }\n </div>\n} @else {\n @for (section of sections(); track section.key) {\n <div\n class=\"sd-sidebar-v4-menu-tree__section\"\n [attr.data-v4-section]=\"section.label ?? ''\"\n [attr.role]=\"section.label ? 'group' : null\"\n [attr.aria-labelledby]=\"section.label ? section.labelId : null\"\n [class.sd-sidebar-v4-menu-tree__section--separated]=\"section.separated\">\n @if (section.label) {\n <div data-v4-section-label class=\"sd-sidebar-v4-menu-tree__section-label\" [id]=\"section.labelId\">{{ section.label }}</div>\n }\n @for (node of section.nodes; track node.key) {\n <div\n class=\"sd-sidebar-v4-menu-tree__item\"\n [class.sd-sidebar-v4-menu-tree__item--nested]=\"node.depth > 0\"\n [class.sd-sidebar-v4-menu-tree__item--pinnable]=\"node.pinnable\"\n [attr.data-v4-item]=\"node.key\"\n [style.padding-left.px]=\"node.depth ? node.paddingLeft : null\">\n @for (offset of node.branchOffsets; track offset) {\n <span data-menu-branch class=\"sd-sidebar-v4-menu-tree__branch\" [style.left.px]=\"offset\" aria-hidden=\"true\"></span>\n }\n @if (node.isActive && node.depth > 0) {\n <span data-v4-marker class=\"sd-sidebar-v4-menu-tree__marker\" [style.left.px]=\"node.markerLeft\" aria-hidden=\"true\"></span>\n }\n @if (node.isGroup) {\n <button\n type=\"button\"\n data-v4-row=\"group\"\n class=\"sd-sidebar-v4-menu-tree__row sd-sidebar-v4-menu-tree__row--group\"\n [class.sd-sidebar-v4-menu-tree__row--child]=\"node.depth > 0\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"node.disabled\"\n [attr.data-menu-group]=\"node.key\"\n [attr.aria-expanded]=\"node.disabled ? null : node.isExpanded\"\n [attr.aria-disabled]=\"node.disabled || null\"\n (click)=\"onToggleGroup(node)\">\n @if (node.depth === 0) {\n <ng-container\n [ngTemplateOutlet]=\"menuIcon\"\n [ngTemplateOutletContext]=\"{ $implicit: node.menu, filled: false, group: true }\" />\n }\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n @if (node.showActiveDot) {\n <span data-v4-active-dot class=\"sd-sidebar-v4-menu-tree__dot\" aria-hidden=\"true\"></span>\n }\n @if (!node.disabled) {\n <sd-icon\n data-v4-chevron\n class=\"sd-sidebar-v4-menu-tree__chevron\"\n [name]=\"node.isExpanded ? 'expand_less' : 'expand_more'\"\n size=\"20px\"></sd-icon>\n }\n </button>\n } @else {\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__row\"\n [class.sd-sidebar-v4-menu-tree__row--child]=\"node.depth > 0\"\n [class.sd-sidebar-v4-menu-tree__row--active]=\"node.isActive\"\n [class.sd-sidebar-v4-menu-tree__row--disabled]=\"node.disabled\"\n [attr.data-v4-row]=\"node.depth ? 'child' : 'root'\"\n [attr.data-menu-key]=\"node.key\"\n [attr.aria-current]=\"node.isActive ? 'page' : null\"\n [attr.aria-disabled]=\"node.disabled || null\"\n (click)=\"onNavigate(node.menu)\">\n @if (node.depth === 0) {\n <ng-container\n [ngTemplateOutlet]=\"menuIcon\"\n [ngTemplateOutletContext]=\"{ $implicit: node.menu, filled: node.isActive, group: false }\" />\n }\n <span class=\"sd-sidebar-v4-menu-tree__label\">{{ node.title }}</span>\n <ng-container [ngTemplateOutlet]=\"trailingTemplate\" [ngTemplateOutletContext]=\"{ $implicit: node.trailing }\" />\n </button>\n @if (node.pinnable) {\n <ng-container\n [ngTemplateOutlet]=\"pinTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: node.menu, key: node.key, pinned: node.isPinned, label: node.pinLabel }\" />\n }\n }\n </div>\n }\n </div>\n }\n}\n\n<ng-template #menuIcon let-menu let-filled=\"filled\" let-group=\"group\">\n @if (menu.iconUrl) {\n <img data-menu-icon class=\"sd-sidebar-v4-menu-tree__icon-image\" [src]=\"menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon\n data-menu-icon\n class=\"sd-sidebar-v4-menu-tree__icon\"\n [name]=\"menu.icon || (group ? 'folder' : 'chevron_right')\"\n [fontSet]=\"filled ? 'material-icons' : 'material-icons-outlined'\"\n size=\"20px\"></sd-icon>\n }\n</ng-template>\n\n<ng-template #railContent let-item>\n <ng-container\n [ngTemplateOutlet]=\"menuIcon\"\n [ngTemplateOutletContext]=\"{ $implicit: item.menu, filled: item.isActive, group: item.isGroup }\" />\n @if (item.badge) {\n <span\n data-v4-rail-badge\n class=\"sd-sidebar-v4-menu-tree__rail-badge\"\n [class.sd-sidebar-v4-menu-tree__badge--warning]=\"item.badge.tone === 'warning'\"\n [class.sd-sidebar-v4-menu-tree__badge--error]=\"item.badge.tone === 'error'\"\n aria-hidden=\"true\">\n {{ item.badge.value }}\n </span>\n } @else if (item.liveTone) {\n <span data-v4-rail-live class=\"sd-sidebar-v4-menu-tree__rail-live\" [attr.data-tone]=\"item.liveTone\" aria-hidden=\"true\"></span>\n }\n</ng-template>\n\n<ng-template #trailingTemplate let-trailing>\n @switch (trailing?.kind) {\n @case ('soon') {\n <span data-v4-trailing=\"soon\" class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__chip\">\n {{ 'core.module.layout.sidebar.coming-soon' | sdTranslate }}\n </span>\n }\n @case ('count') {\n <span data-v4-trailing=\"count\" class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__count\">{{ trailing.value }}</span>\n }\n @case ('badge') {\n <span\n data-v4-trailing=\"badge\"\n class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__badge\"\n [class.sd-sidebar-v4-menu-tree__badge--warning]=\"trailing.tone === 'warning'\"\n [class.sd-sidebar-v4-menu-tree__badge--error]=\"trailing.tone === 'error'\"\n role=\"img\"\n [attr.aria-label]=\"'core.module.layout.sidebar.badge-pending' | sdTranslate: { count: trailing.value }\">\n {{ trailing.value }}\n </span>\n }\n @case ('status') {\n <span\n data-v4-trailing=\"status\"\n class=\"sd-sidebar-v4-menu-tree__trailing sd-sidebar-v4-menu-tree__status\"\n [attr.data-tone]=\"trailing.tone\">\n <span\n data-v4-status-dot\n class=\"sd-sidebar-v4-menu-tree__status-dot\"\n [class.sd-sidebar-v4-menu-tree__status-dot--live]=\"trailing.live\"\n aria-hidden=\"true\"></span>\n {{ trailing.label }}\n </span>\n }\n }\n</ng-template>\n\n<ng-template #pinTemplate let-menu let-key=\"key\" let-pinned=\"pinned\" let-label=\"label\">\n <button\n type=\"button\"\n class=\"sd-sidebar-v4-menu-tree__pin\"\n [attr.data-pin-key]=\"key\"\n [attr.aria-label]=\"label\"\n [attr.aria-pressed]=\"pinned\"\n (click)=\"onTogglePinned($event, menu)\">\n <sd-icon name=\"push_pin\" [fontSet]=\"pinned ? 'material-icons' : 'material-icons-outlined'\" size=\"18px\"></sd-icon>\n </button>\n</ng-template>\n", styles: [":host{--tree-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--tree-active-bg: var(--sd-sidebar-v4-active-bg, var(--sd-primary-light));--tree-active-ink: var(--sd-sidebar-v4-active-ink, var(--sd-primary));--tree-active-shadow: var(--sd-sidebar-v4-active-shadow, none);--tree-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--tree-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--tree-branch: color-mix(in srgb, var(--sd-border) 60%, var(--sd-surface));--tree-attention: var(--sd-sidebar-v4-attention, var(--sd-warning));--tree-live: var(--sd-sidebar-v4-live, var(--sd-success));--tree-muted-ink: var(--sd-text-secondary);--tree-disabled-ink: var(--sd-disabled-text, color-mix(in srgb, var(--sd-text) 60%, transparent));--tree-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));--tree-radius: var(--sd-sidebar-v4-item-radius, var(--sd-radius-999, 999px));--tree-row-height: var(--sd-sidebar-v4-item-height, 36px);--tree-child-height: var(--sd-sidebar-v4-child-height, 32px);display:block;min-width:0;color:var(--sd-text)}:host(.sd-sidebar-v4-menu-tree--mobile){--tree-row-height: var(--sd-sidebar-v4-item-height, 44px);--tree-child-height: var(--sd-sidebar-v4-child-height, 44px)}:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__pin{position:static;flex:0 0 44px;align-self:center;width:44px;height:44px;transform:none;opacity:1;pointer-events:auto}:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable>.sd-sidebar-v4-menu-tree__row,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row{padding-right:var(--sd-space-12, 12px)}:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing,:host(.sd-sidebar-v4-menu-tree--mobile) .sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing{visibility:visible}.sd-sidebar-v4-menu-tree__sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.sd-sidebar-v4-menu-tree__section--separated{margin-top:var(--sd-space-16, 16px)}.sd-sidebar-v4-menu-tree__section-label{padding:14px 12px 4px;color:var(--tree-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-sidebar-v4-menu-tree__item{position:relative;display:flex;align-items:stretch;min-width:0}.sd-sidebar-v4-menu-tree__row{display:flex;flex:1 1 auto;align-items:center;gap:var(--sd-space-12, 12px);box-sizing:border-box;width:100%;min-width:0;min-height:var(--tree-row-height, 36px);margin:0;padding:0 var(--sd-space-12, 12px);border:0;border-radius:var(--tree-radius, 999px);background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-20, 20px);text-align:left;cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__row:hover{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__row--group{padding:0 var(--sd-space-8, 8px) 0 var(--sd-space-12, 12px)}.sd-sidebar-v4-menu-tree__row--child{gap:var(--sd-space-8, 8px);min-height:var(--tree-child-height, 32px)}.sd-sidebar-v4-menu-tree__row--active,.sd-sidebar-v4-menu-tree__row--active:hover{background:var(--tree-active-bg);box-shadow:var(--tree-active-shadow);color:var(--tree-active-ink);font-weight:var(--sd-font-weight-medium, 500)}.sd-sidebar-v4-menu-tree__row--disabled,.sd-sidebar-v4-menu-tree__row--disabled:hover{background:transparent;color:var(--tree-disabled-ink);cursor:not-allowed}.sd-sidebar-v4-menu-tree__row:focus-visible{outline:none;box-shadow:var(--tree-focus-ring)}.sd-sidebar-v4-menu-tree__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__icon-image{flex:0 0 20px;width:20px;height:20px;color:var(--tree-muted-ink)}.sd-sidebar-v4-menu-tree__icon-image{object-fit:contain}.sd-sidebar-v4-menu-tree__row--active .sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__rail-item--active .sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__row--disabled .sd-sidebar-v4-menu-tree__icon,.sd-sidebar-v4-menu-tree__rail-item--disabled .sd-sidebar-v4-menu-tree__icon{color:inherit}.sd-sidebar-v4-menu-tree__row--disabled .sd-sidebar-v4-menu-tree__icon-image,.sd-sidebar-v4-menu-tree__rail-item--disabled .sd-sidebar-v4-menu-tree__icon-image{opacity:.6}.sd-sidebar-v4-menu-tree__chevron{flex:0 0 20px;color:var(--tree-muted-ink)}.sd-sidebar-v4-menu-tree__dot{flex:none;width:6px;height:6px;border-radius:3px;background:var(--sd-primary)}.sd-sidebar-v4-menu-tree__item--nested{min-height:var(--tree-child-height, 32px);animation:sd-sidebar-v4-expand-in .16s ease-out}@keyframes sd-sidebar-v4-expand-in{0%{opacity:0}}.sd-sidebar-v4-menu-tree__branch{position:absolute;top:0;bottom:0;width:1px;background:var(--tree-branch);pointer-events:none}.sd-sidebar-v4-menu-tree__marker{position:absolute;z-index:1;top:7px;bottom:7px;width:3px;border-radius:var(--sd-radius-2, 2px);background:var(--sd-primary);pointer-events:none}.sd-sidebar-v4-menu-tree__trailing{flex:none}.sd-sidebar-v4-menu-tree__count{color:var(--tree-muted-ink);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__row--active .sd-sidebar-v4-menu-tree__count{color:inherit}.sd-sidebar-v4-menu-tree__badge,.sd-sidebar-v4-menu-tree__rail-badge{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-weight:var(--sd-font-weight-medium, 500);line-height:1}.sd-sidebar-v4-menu-tree__badge{min-width:20px;height:20px;padding:0 6px;border-radius:var(--sd-radius-10, 10px);font-size:11.5px}.sd-sidebar-v4-menu-tree__badge--warning{background:var(--tree-attention);color:var(--sd-warning-contrast)}.sd-sidebar-v4-menu-tree__badge--error{background:var(--sd-error);color:var(--sd-error-contrast)}.sd-sidebar-v4-menu-tree__status,.sd-sidebar-v4-menu-tree__rail-live{--tree-tone: var(--tree-live)}.sd-sidebar-v4-menu-tree__status[data-tone=warning],.sd-sidebar-v4-menu-tree__rail-live[data-tone=warning]{--tree-tone: var(--sd-warning)}.sd-sidebar-v4-menu-tree__status[data-tone=error],.sd-sidebar-v4-menu-tree__rail-live[data-tone=error]{--tree-tone: var(--sd-error)}.sd-sidebar-v4-menu-tree__status{display:inline-flex;align-items:center;gap:6px;color:var(--tree-tone);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__status-dot{flex:none;width:6px;height:6px;border-radius:3px;background:var(--tree-tone)}.sd-sidebar-v4-menu-tree__status-dot--live{box-shadow:0 0 0 3px color-mix(in srgb,var(--tree-tone) 18%,transparent)}.sd-sidebar-v4-menu-tree__chip{padding:0 7px;border:1px solid var(--sd-border);border-radius:var(--sd-radius-999, 999px);color:var(--tree-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-18, 18px)}.sd-sidebar-v4-menu-tree__pin{position:absolute;top:50%;right:2px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;margin:0;padding:0;border:0;border-radius:var(--tree-radius, 999px);background:transparent;color:var(--tree-muted-ink);cursor:pointer;opacity:0;pointer-events:none;transform:translateY(-50%);transition:opacity var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__pin:hover{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__pin:focus-visible{outline:none;box-shadow:var(--tree-focus-ring)}.sd-sidebar-v4-menu-tree__item:hover>.sd-sidebar-v4-menu-tree__pin,.sd-sidebar-v4-menu-tree__pin:focus-visible,.sd-sidebar-v4-menu-tree__item--shortcut>.sd-sidebar-v4-menu-tree__pin{opacity:1;pointer-events:auto}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row{padding-right:40px}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing{visibility:hidden}.sd-sidebar-v4-menu-tree__row--shortcut{gap:var(--sd-space-8, 8px)}.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row{padding-right:40px}.sd-sidebar-v4-menu-tree__shortcut-path{color:var(--tree-muted-ink);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-regular, 400)}.sd-sidebar-v4-menu-tree__results{display:flex;flex-direction:column}.sd-sidebar-v4-menu-tree__result{display:flex;flex-direction:column;justify-content:center;box-sizing:border-box;min-height:var(--tree-row-height, 36px);padding:6px var(--sd-space-12, 12px);border-radius:var(--sd-radius-16, 16px);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__result:hover{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__result--focused,.sd-sidebar-v4-menu-tree__result--focused:hover{background:var(--sd-surface);box-shadow:inset 0 0 0 2px var(--sd-primary)}.sd-sidebar-v4-menu-tree__result-title{color:var(--sd-text);font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);overflow-wrap:anywhere}.sd-sidebar-v4-menu-tree__match{border-radius:3px;background:var(--sd-primary-light);color:var(--sd-primary-dark);font-weight:var(--sd-font-weight-medium, 500)}.sd-sidebar-v4-menu-tree__result-path{margin-top:1px;color:var(--tree-muted-ink);font-size:11.5px;line-height:var(--sd-line-height-16, 16px);overflow-wrap:anywhere}.sd-sidebar-v4-menu-tree__empty{padding:var(--sd-space-16, 16px) var(--sd-space-12, 12px);color:var(--tree-muted-ink);font-size:var(--sd-font-size-13, 13px);overflow-wrap:anywhere}.sd-sidebar-v4-menu-tree__hint{padding:var(--sd-space-12, 12px) var(--sd-space-12, 12px) 0;color:var(--tree-muted-ink);font-size:11.5px;line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__rail{display:flex;flex-direction:column;align-items:center;gap:var(--sd-space-4, 4px)}.sd-sidebar-v4-menu-tree__rail-cell{position:relative;display:flex}.sd-sidebar-v4-menu-tree__rail-item{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:48px;height:36px;margin:0;padding:0;border:0;border-radius:var(--tree-radius, 999px);background:transparent;color:var(--tree-muted-ink);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4-menu-tree__rail-item:hover,.sd-sidebar-v4-menu-tree__rail-item.sd-sidebar-v4-menu-tree__rail-item--open{background:var(--tree-hover-bg)}.sd-sidebar-v4-menu-tree__rail-item--active,.sd-sidebar-v4-menu-tree__rail-item--active:hover{background:var(--tree-active-bg);box-shadow:var(--tree-active-shadow);color:var(--tree-active-ink)}.sd-sidebar-v4-menu-tree__rail-item--disabled,.sd-sidebar-v4-menu-tree__rail-item--disabled:hover{background:transparent;color:var(--tree-disabled-ink);cursor:not-allowed}.sd-sidebar-v4-menu-tree__rail-item:focus-visible{outline:none;box-shadow:var(--tree-focus-ring)}.sd-sidebar-v4-menu-tree__rail-separator{flex:none;width:32px;height:1px;margin:5px 0;background:var(--tree-line)}.sd-sidebar-v4-menu-tree__rail-badge{position:absolute;top:0;right:2px;min-width:16px;height:16px;padding:0 4px;border-radius:var(--sd-radius-8, 8px);font-size:var(--sd-font-size-10, 10px);box-shadow:0 0 0 2px var(--tree-bg);pointer-events:none}.sd-sidebar-v4-menu-tree__rail-live{position:absolute;top:5px;right:9px;width:8px;height:8px;border-radius:var(--sd-radius-4, 4px);background:var(--tree-tone);box-shadow:0 0 0 2px var(--tree-bg);pointer-events:none}.sd-sidebar-v4-menu-tree__flyout{--tree-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--tree-active-bg: var(--sd-sidebar-v4-active-bg, var(--sd-primary-light));--tree-active-ink: var(--sd-sidebar-v4-active-ink, var(--sd-primary));--tree-active-shadow: var(--sd-sidebar-v4-active-shadow, none);--tree-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--tree-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--tree-branch: color-mix(in srgb, var(--sd-border) 60%, var(--sd-surface));--tree-attention: var(--sd-sidebar-v4-attention, var(--sd-warning));--tree-live: var(--sd-sidebar-v4-live, var(--sd-success));--tree-muted-ink: var(--sd-text-secondary);--tree-disabled-ink: var(--sd-disabled-text, color-mix(in srgb, var(--sd-text) 60%, transparent));--tree-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));--tree-radius: var(--sd-sidebar-v4-item-radius, var(--sd-radius-999, 999px));--tree-row-height: var(--sd-sidebar-v4-item-height, 36px);--tree-child-height: var(--sd-sidebar-v4-child-height, 32px);box-sizing:border-box;width:232px;padding:var(--sd-space-8, 8px);border:1px solid var(--tree-line);border-radius:var(--sd-radius-16, 16px);background:var(--sd-surface);color:var(--sd-text);box-shadow:0 6px 24px color-mix(in srgb,var(--sd-text) 14%,transparent);animation:sd-sidebar-v4-flyout-in .14s ease-out}.sd-sidebar-v4-menu-tree__flyout:focus{outline:none}.sd-sidebar-v4-menu-tree__flyout-title{padding:6px var(--sd-space-12, 12px);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-20, 20px)}.sd-sidebar-v4-menu-tree__flyout-heading{display:flex;align-items:center;gap:var(--sd-space-8, 8px);padding:6px var(--sd-space-12, 12px) 2px;color:var(--tree-muted-ink);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px)}.sd-sidebar-v4-menu-tree__flyout-heading--disabled{color:var(--tree-disabled-ink)}.sd-sidebar-v4-menu-tree__row--flyout{gap:var(--sd-space-8, 8px);height:32px;min-height:32px}@keyframes sd-sidebar-v4-flyout-in{0%{opacity:0;transform:translate(-4px)}}@media(pointer:coarse){.sd-sidebar-v4-menu-tree__row{min-height:max(44px,var(--tree-row-height, 36px))}.sd-sidebar-v4-menu-tree__row--child{min-height:max(44px,var(--tree-child-height, 32px))}.sd-sidebar-v4-menu-tree__result{min-height:max(44px,var(--tree-row-height, 36px))}.sd-sidebar-v4-menu-tree__row--flyout{height:auto;min-height:44px}.sd-sidebar-v4-menu-tree__rail-item{height:44px}.sd-sidebar-v4-menu-tree__pin{position:static;flex:0 0 44px;align-self:center;width:44px;height:44px;transform:none;opacity:1;pointer-events:auto}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable>.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__item--shortcut.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row{padding-right:var(--sd-space-12, 12px)}.sd-sidebar-v4-menu-tree__item--pinnable:hover>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing,.sd-sidebar-v4-menu-tree__item--pinnable:has(>.sd-sidebar-v4-menu-tree__pin:focus-visible)>.sd-sidebar-v4-menu-tree__row .sd-sidebar-v4-menu-tree__trailing{visibility:visible}}@media(prefers-reduced-motion:reduce){.sd-sidebar-v4-menu-tree__row,.sd-sidebar-v4-menu-tree__pin,.sd-sidebar-v4-menu-tree__result,.sd-sidebar-v4-menu-tree__rail-item{transition:none}.sd-sidebar-v4-menu-tree__flyout,.sd-sidebar-v4-menu-tree__item--nested{animation:none}}\n"] }]
|
|
3798
|
+
}], ctorParameters: () => [], propDecorators: { menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], pathSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "pathSource", required: false }] }], activePath: [{ type: i0.Input, args: [{ isSignal: true, alias: "activePath", required: false }] }], presentation: [{ type: i0.Input, args: [{ isSignal: true, alias: "presentation", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], collapsedGroupKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsedGroupKeys", required: false }] }, { type: i0.Output, args: ["collapsedGroupKeysChange"] }], pinnedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinnedKeys", required: false }] }], showPin: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPin", required: false }] }], collapsedGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsedGroup", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], focusedIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedIndex", required: false }] }], navigate: [{ type: i0.Output, args: ["navigate"] }], togglePinned: [{ type: i0.Output, args: ["togglePinned"] }], expandGroup: [{ type: i0.Output, args: ["expandGroup"] }] } });
|
|
3799
|
+
/** Parent path of every menu in the tree, keyed by object and by stable key (so equal menus from another array still resolve). */
|
|
3800
|
+
function collectParentPaths(menus) {
|
|
3801
|
+
const paths = new Map();
|
|
3802
|
+
const visit = (items, titles, section) => {
|
|
3803
|
+
for (const menu of items) {
|
|
3804
|
+
if (!menu || typeof menu !== 'object')
|
|
3805
|
+
continue;
|
|
3806
|
+
const path = titles.length ? titles.join(' / ') : section;
|
|
3807
|
+
if (!paths.has(menu))
|
|
3808
|
+
paths.set(menu, path);
|
|
3809
|
+
const key = getMenuStableKey(menu);
|
|
3810
|
+
if (key && !paths.has(key))
|
|
3811
|
+
paths.set(key, path);
|
|
3812
|
+
if ('children' in menu && Array.isArray(menu.children)) {
|
|
3813
|
+
const title = (menu.title ?? menu.tooltipTitle ?? '').trim();
|
|
3814
|
+
visit(menu.children, title ? [...titles, title] : titles, section);
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
};
|
|
3818
|
+
for (const menu of menus ?? []) {
|
|
3819
|
+
if (!menu || typeof menu !== 'object')
|
|
3820
|
+
continue;
|
|
3821
|
+
visit([menu], [], typeof menu.section === 'string' ? menu.section.trim() : '');
|
|
3822
|
+
}
|
|
3823
|
+
return paths;
|
|
3824
|
+
}
|
|
3825
|
+
function lookupParentPath(paths, menu) {
|
|
3826
|
+
return paths.get(menu) ?? paths.get(getMenuStableKey(menu)) ?? '';
|
|
3827
|
+
}
|
|
3828
|
+
// Cùng bộ ký tự mà StringUtilities.changeAliasLowerCase thay bằng khoảng trắng.
|
|
3829
|
+
const PUNCTUATION = /[!@%^*()+=<>?/,.:;'"&#[\]~$_`\-{}|\\]/;
|
|
3830
|
+
const COMBINING_MARKS = /[\u0300-\u036f]/g;
|
|
3831
|
+
const D_STROKE = /\u0111/g;
|
|
3832
|
+
const WHITESPACE = /\s/;
|
|
3833
|
+
function foldCharacter(character) {
|
|
3834
|
+
if (PUNCTUATION.test(character))
|
|
3835
|
+
return ' ';
|
|
3836
|
+
return character.toLowerCase().normalize('NFD').replace(COMBINING_MARKS, '').replace(D_STROKE, 'd');
|
|
3837
|
+
}
|
|
3838
|
+
/** Folds like `aliasIncludes` (no case, no accents, punctuation as one space) and maps every folded character to its source index. */
|
|
3839
|
+
function foldText(text) {
|
|
3840
|
+
let folded = '';
|
|
3841
|
+
const sources = [];
|
|
3842
|
+
for (let index = 0; index < text.length; index++) {
|
|
3843
|
+
for (const character of foldCharacter(text[index])) {
|
|
3844
|
+
const isSpace = WHITESPACE.test(character);
|
|
3845
|
+
if (isSpace && (!folded || folded.endsWith(' ')))
|
|
3846
|
+
continue;
|
|
3847
|
+
folded += isSpace ? ' ' : character;
|
|
3848
|
+
sources.push(index);
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
return { folded, sources };
|
|
3852
|
+
}
|
|
3853
|
+
/**
|
|
3854
|
+
* Splits `text` around the first accent-insensitive occurrence of `query`. The result is rendered through text
|
|
3855
|
+
* interpolation only, so neither the title nor the query can inject markup.
|
|
3856
|
+
*/
|
|
3857
|
+
function highlightSegments(text, query) {
|
|
3858
|
+
const needle = foldText(query ?? '').folded.trim();
|
|
3859
|
+
if (!needle)
|
|
3860
|
+
return [{ text, match: false }];
|
|
3861
|
+
const { folded, sources } = foldText(text);
|
|
3862
|
+
const at = folded.indexOf(needle);
|
|
3863
|
+
if (at < 0)
|
|
3864
|
+
return [{ text, match: false }];
|
|
3865
|
+
const start = sources[at];
|
|
3866
|
+
let end = sources[at + needle.length - 1] + 1;
|
|
3867
|
+
// why: dấu tổ hợp (chuỗi NFD) đứng sau ký tự khớp cuối thuộc về ký tự đó — giữ trong phần highlight.
|
|
3868
|
+
while (end < text.length && !foldCharacter(text[end]))
|
|
3869
|
+
end++;
|
|
3870
|
+
return [
|
|
3871
|
+
{ text: text.slice(0, start), match: false },
|
|
3872
|
+
{ text: text.slice(start, end), match: true },
|
|
3873
|
+
{ text: text.slice(end), match: false },
|
|
3874
|
+
].filter(segment => !!segment.text);
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
/**
|
|
3878
|
+
* Sidebar V4 desktop shell: a 280px drawer (72px rail when collapsed) with the brand header and Context Switcher,
|
|
3879
|
+
* a pill search (`Ctrl+K` / `⌘K`), Pinned and Recent shortcuts, the V4 menu tree and the account footer.
|
|
3880
|
+
* Routed content is projected into `<main>`.
|
|
3881
|
+
*
|
|
3882
|
+
* Routing, recent/pinned handling and the collapse preference behave like `sd-sidebar-v3`; the collapsed state is
|
|
3883
|
+
* stored in the same version 3 entry (D-004). Options are read only after `normalizeSidebarConfiguration` (INV-012);
|
|
3884
|
+
* `brandColor` / `brandLightColor` are ignored. Size tokens (`--sd-sidebar-v4-width`, `-rail-width`, `-item-height`,
|
|
3885
|
+
* `-child-height`, `-item-radius`) are declared on the host and follow `density`, `itemShape` and the pointer type.
|
|
3886
|
+
*/
|
|
3887
|
+
class SdSidebarV4 {
|
|
3888
|
+
#router = inject(Router);
|
|
3889
|
+
#destroyRef = inject(DestroyRef);
|
|
3890
|
+
#changeDetector = inject(ChangeDetectorRef);
|
|
3891
|
+
#navigationState = inject(SdLayoutNavigationStateService);
|
|
3892
|
+
#document = inject(DOCUMENT);
|
|
3893
|
+
#applePlatform = isApplePlatform(this.#document.defaultView?.navigator);
|
|
3894
|
+
/** Requested result index; `focusedResultIndex` clamps it to the current results. */
|
|
3895
|
+
#focusRequest = signal(0, /* @ts-ignore */
|
|
3896
|
+
...(ngDevMode ? [{ debugName: "#focusRequest" }] : /* istanbul ignore next */ []));
|
|
3897
|
+
#initialized = false;
|
|
3898
|
+
searchInput = viewChild('searchInput', /* @ts-ignore */
|
|
3899
|
+
...(ngDevMode ? [{ debugName: "searchInput" }] : /* istanbul ignore next */ []));
|
|
3900
|
+
list = viewChild.required('list', /* @ts-ignore */
|
|
3901
|
+
...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
|
|
3902
|
+
mainTree = viewChild.required('mainTree', /* @ts-ignore */
|
|
3903
|
+
...(ngDevMode ? [{ debugName: "mainTree" }] : /* istanbul ignore next */ []));
|
|
3904
|
+
headerSwitcher = viewChild('headerSwitcher', /* @ts-ignore */
|
|
3905
|
+
...(ngDevMode ? [{ debugName: "headerSwitcher" }] : /* istanbul ignore next */ []));
|
|
3906
|
+
menus = input([], /* @ts-ignore */
|
|
3907
|
+
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
3908
|
+
userInfo = input.required(/* @ts-ignore */
|
|
3909
|
+
...(ngDevMode ? [{ debugName: "userInfo" }] : /* istanbul ignore next */ []));
|
|
3910
|
+
sidebar = input.required(/* @ts-ignore */
|
|
3911
|
+
...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
|
|
3912
|
+
/** `sidebar()` with the V4 defaults filled by `normalizeSidebarConfiguration`, the only place they are resolved (INV-012). */
|
|
3913
|
+
configuration = computed(() => normalizeSidebarConfiguration(this.sidebar()), /* @ts-ignore */
|
|
3914
|
+
...(ngDevMode ? [{ debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
3915
|
+
isCollapsed = signal(false, /* @ts-ignore */
|
|
3916
|
+
...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
|
|
3917
|
+
collapsedGroupKeys = signal([], /* @ts-ignore */
|
|
3918
|
+
...(ngDevMode ? [{ debugName: "collapsedGroupKeys" }] : /* istanbul ignore next */ []));
|
|
3919
|
+
searchText = signal('', /* @ts-ignore */
|
|
3920
|
+
...(ngDevMode ? [{ debugName: "searchText" }] : /* istanbul ignore next */ []));
|
|
3921
|
+
activePath = signal(this.#router.url.split(/[?#]/, 1)[0] ?? '', /* @ts-ignore */
|
|
3922
|
+
...(ngDevMode ? [{ debugName: "activePath" }] : /* istanbul ignore next */ []));
|
|
3923
|
+
/** Search results in the order the tree renders its options (accent-insensitive, without `comingSoon` items). */
|
|
3924
|
+
searchResults = computed(() => buildSidebarV4SearchResults(this.menus(), this.searchText()), /* @ts-ignore */
|
|
3925
|
+
...(ngDevMode ? [{ debugName: "searchResults" }] : /* istanbul ignore next */ []));
|
|
3926
|
+
/** Index of the keyboard-selected result: the first one when results appear, -1 when there is none. */
|
|
3927
|
+
focusedResultIndex = computed(() => {
|
|
3928
|
+
const count = this.searchResults().length;
|
|
3929
|
+
return count ? Math.min(Math.max(this.#focusRequest(), 0), count - 1) : -1;
|
|
3930
|
+
}, /* @ts-ignore */
|
|
3931
|
+
...(ngDevMode ? [{ debugName: "focusedResultIndex" }] : /* istanbul ignore next */ []));
|
|
3932
|
+
recentConfiguration = computed(() => this.configuration().recent, /* @ts-ignore */
|
|
3933
|
+
...(ngDevMode ? [{ debugName: "recentConfiguration" }] : /* istanbul ignore next */ []));
|
|
3934
|
+
pinnedKeys = this.#navigationState.pinnedKeys;
|
|
3935
|
+
pinnedMenus = this.#navigationState.pinnedMenus;
|
|
3936
|
+
recentMenus = this.#navigationState.recentMenus;
|
|
3937
|
+
hasQuery = computed(() => !!this.searchText().trim(), /* @ts-ignore */
|
|
3938
|
+
...(ngDevMode ? [{ debugName: "hasQuery" }] : /* istanbul ignore next */ []));
|
|
3939
|
+
title = computed(() => this.configuration().defaultTitle || 'Back Office', /* @ts-ignore */
|
|
3940
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
3941
|
+
logoInitial = computed(() => Array.from(this.title().trim())[0]?.toLocaleUpperCase() ?? '', /* @ts-ignore */
|
|
3942
|
+
...(ngDevMode ? [{ debugName: "logoInitial" }] : /* istanbul ignore next */ []));
|
|
3943
|
+
/** The hierarchy starts with items that have no section heading. */
|
|
3944
|
+
leadsWithUnsectioned = computed(() => groupMenusBySection(this.menus())[0]?.section === null, /* @ts-ignore */
|
|
3945
|
+
...(ngDevMode ? [{ debugName: "leadsWithUnsectioned" }] : /* istanbul ignore next */ []));
|
|
3946
|
+
shortcutHint = this.#applePlatform ? '⌘K' : 'Ctrl K';
|
|
3947
|
+
shortcutKeys = this.#applePlatform ? 'Meta+K' : 'Control+K';
|
|
3948
|
+
/** The header Context Switcher popover is open; the whole header then takes the hover background (README CS1). */
|
|
3949
|
+
contextOpen = computed(() => this.headerSwitcher()?.isOpen() ?? false, /* @ts-ignore */
|
|
3950
|
+
...(ngDevMode ? [{ debugName: "contextOpen" }] : /* istanbul ignore next */ []));
|
|
3951
|
+
constructor() {
|
|
3952
|
+
effect(() => {
|
|
3953
|
+
const menus = this.menus();
|
|
3954
|
+
const configuration = this.configuration();
|
|
3955
|
+
untracked(() => {
|
|
3956
|
+
this.#navigationState.hydrate(menus, configuration.recent.maxItems);
|
|
3957
|
+
if (this.#initialized)
|
|
3958
|
+
return;
|
|
3959
|
+
const persistedCollapsed = this.#navigationState.versionState(3).collapsed;
|
|
3960
|
+
this.isCollapsed.set(typeof persistedCollapsed === 'boolean' ? persistedCollapsed : configuration.defaultCollapsed);
|
|
3961
|
+
this.#initialized = true;
|
|
3962
|
+
});
|
|
3963
|
+
});
|
|
3964
|
+
this.#router.events.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
3965
|
+
if (event instanceof NavigationEnd)
|
|
3966
|
+
this.activePath.set(event.urlAfterRedirects.split(/[?#]/, 1)[0] ?? '');
|
|
3967
|
+
});
|
|
3968
|
+
effect(() => {
|
|
3969
|
+
const menus = this.menus();
|
|
3970
|
+
const activeMenuPath = resolveActiveMenuPath(menus, this.activePath());
|
|
3971
|
+
if (!activeMenuPath)
|
|
3972
|
+
return;
|
|
3973
|
+
const activeGroupKeys = new Set();
|
|
3974
|
+
const visit = (items, ancestors) => {
|
|
3975
|
+
for (const menu of items) {
|
|
3976
|
+
if (!('children' in menu) || !containsMenuPath(menu, activeMenuPath))
|
|
3977
|
+
continue;
|
|
3978
|
+
const key = getMenuStableKey(menu, ancestors);
|
|
3979
|
+
activeGroupKeys.add(key);
|
|
3980
|
+
visit(menu.children ?? [], [...ancestors, menu.title ?? key]);
|
|
3981
|
+
}
|
|
3982
|
+
};
|
|
3983
|
+
visit(menus, []);
|
|
3984
|
+
// why: Chỉ mở nhánh khi route/menu đổi; người dùng vẫn được đóng nhánh đang active.
|
|
3985
|
+
untracked(() => this.collapsedGroupKeys.update(keys => keys.filter(key => !activeGroupKeys.has(key))));
|
|
3986
|
+
});
|
|
3987
|
+
}
|
|
3988
|
+
/** Collapses or expands the drawer and stores the choice in the version 3 entry, like V3 (D-004). */
|
|
3989
|
+
toggleCollapsed() {
|
|
3990
|
+
this.#setCollapsed(!this.isCollapsed());
|
|
3991
|
+
}
|
|
3992
|
+
/** Expands a collapsed drawer, then moves focus to the menu search. */
|
|
3993
|
+
focusSearch() {
|
|
3994
|
+
if (this.isCollapsed()) {
|
|
3995
|
+
this.#setCollapsed(false);
|
|
3996
|
+
// why: ô search chỉ render khi drawer mở rộng — chạy change detection ngay để có phần tử mà focus.
|
|
3997
|
+
this.#changeDetector.detectChanges();
|
|
3998
|
+
}
|
|
3999
|
+
const field = this.searchInput()?.nativeElement;
|
|
4000
|
+
field?.focus();
|
|
4001
|
+
field?.select();
|
|
4002
|
+
}
|
|
4003
|
+
/** Collapsed rail: a leaf navigates; a group expands the drawer and opens that group, like V3. */
|
|
4004
|
+
activateCollapsedMenu(menu) {
|
|
4005
|
+
if ('path' in menu) {
|
|
4006
|
+
this.navigateMenu(menu);
|
|
4007
|
+
return;
|
|
4008
|
+
}
|
|
4009
|
+
const key = getMenuStableKey(menu);
|
|
4010
|
+
this.#setCollapsed(false);
|
|
4011
|
+
this.collapsedGroupKeys.update(keys => keys.filter(current => current !== key));
|
|
4012
|
+
}
|
|
4013
|
+
navigateMenu(menu) {
|
|
4014
|
+
if (!('path' in menu))
|
|
4015
|
+
return;
|
|
4016
|
+
this.#navigationState.recordRecent(menu, this.recentConfiguration());
|
|
4017
|
+
// why: `includes('http')` là substring test — `javascript:fetch(...)//http` lọt qua và chạy như
|
|
4018
|
+
// script trong origin của app. Parse URL thật rồi mới mở, kèm `noopener,noreferrer`.
|
|
4019
|
+
if (sdIsExternalHttpUrl(menu.path)) {
|
|
4020
|
+
sdOpenExternal(menu.path);
|
|
4021
|
+
return;
|
|
4022
|
+
}
|
|
4023
|
+
void this.#router.navigate([menu.path.split('?')[0]], {
|
|
4024
|
+
queryParams: menu.queryParams ?? {},
|
|
4025
|
+
state: { switchTab: true },
|
|
4026
|
+
});
|
|
4027
|
+
}
|
|
4028
|
+
onTogglePinned(menu) {
|
|
4029
|
+
this.#navigationState.togglePinned(menu);
|
|
4030
|
+
}
|
|
4031
|
+
onSearchInput(event) {
|
|
4032
|
+
const value = event.target.value;
|
|
4033
|
+
this.searchText.set(value);
|
|
4034
|
+
this.#focusRequest.set(0);
|
|
4035
|
+
// why: kết quả bắt đầu ở đầu list và kết quả đầu được chọn sẵn — bỏ vị trí cuộn cũ của cây để nó luôn thấy được.
|
|
4036
|
+
if (value.trim())
|
|
4037
|
+
this.list().nativeElement.scrollTop = 0;
|
|
4038
|
+
}
|
|
4039
|
+
clearSearch() {
|
|
4040
|
+
this.#clearQuery();
|
|
4041
|
+
this.searchInput()?.nativeElement.focus();
|
|
4042
|
+
}
|
|
4043
|
+
onSearchKeydown(event) {
|
|
4044
|
+
if (event.isComposing)
|
|
4045
|
+
return;
|
|
4046
|
+
switch (event.key) {
|
|
4047
|
+
case 'ArrowDown':
|
|
4048
|
+
case 'ArrowUp': {
|
|
4049
|
+
const count = this.searchResults().length;
|
|
4050
|
+
if (!count)
|
|
4051
|
+
return;
|
|
4052
|
+
event.preventDefault();
|
|
4053
|
+
const next = Math.min(Math.max(this.focusedResultIndex() + (event.key === 'ArrowDown' ? 1 : -1), 0), count - 1);
|
|
4054
|
+
this.#focusRequest.set(next);
|
|
4055
|
+
this.#revealResult(next);
|
|
4056
|
+
return;
|
|
4057
|
+
}
|
|
4058
|
+
case 'Enter': {
|
|
4059
|
+
const result = this.searchResults()[this.focusedResultIndex()];
|
|
4060
|
+
if (!result)
|
|
4061
|
+
return;
|
|
4062
|
+
event.preventDefault();
|
|
4063
|
+
this.navigateMenu(result.menu);
|
|
4064
|
+
return;
|
|
4065
|
+
}
|
|
4066
|
+
case 'Escape':
|
|
4067
|
+
if (!this.searchText())
|
|
4068
|
+
return;
|
|
4069
|
+
event.preventDefault();
|
|
4070
|
+
this.#clearQuery();
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
onDocumentKeydown(event) {
|
|
4074
|
+
// why: phím tắt đã được phần khác xử lý (defaultPrevented) thì nhường; chỉ preventDefault khi V4 thật sự xử lý.
|
|
4075
|
+
if (event.defaultPrevented || !this.#isSearchShortcut(event) || this.#focusIsInOverlay())
|
|
4076
|
+
return;
|
|
4077
|
+
event.preventDefault();
|
|
4078
|
+
this.focusSearch();
|
|
4079
|
+
}
|
|
4080
|
+
/** Focus sits in a modal dialog or a CDK overlay (popover, flyout, menu); the shortcut must not pull it to the drawer behind. */
|
|
4081
|
+
#focusIsInOverlay() {
|
|
4082
|
+
return !!this.#document.activeElement?.closest('[aria-modal="true"], .cdk-overlay-container');
|
|
4083
|
+
}
|
|
4084
|
+
#revealResult(index) {
|
|
4085
|
+
// why: listbox cuộn trong nav — option được chọn phải luôn nằm trong vùng thấy được, nếu không Enter mở một mục người
|
|
4086
|
+
// dùng không thấy (WCAG 2.4.11). Option đã render sẵn nên cuộn ngay, không cần chờ render.
|
|
4087
|
+
this.#document.getElementById(this.mainTree().resultOptionId(index))?.scrollIntoView({ block: 'nearest' });
|
|
4088
|
+
}
|
|
4089
|
+
#isSearchShortcut(event) {
|
|
4090
|
+
// why: bàn phím không phải Latin (vd tiếng Nga) cho `key` khác 'k' — chỉ khi đó mới dựa vào phím vật lý KeyK; bố cục
|
|
4091
|
+
// Latin khác (Colemak, Dvorak) giữ nguyên chữ của nó, không chiếm Ctrl/⌘ + chữ đang nằm ở vị trí KeyK.
|
|
4092
|
+
const key = event.key ?? '';
|
|
4093
|
+
const isK = /^[a-z]$/i.test(key) ? key.toLowerCase() === 'k' : event.code === 'KeyK';
|
|
4094
|
+
if (!isK || event.altKey || event.shiftKey)
|
|
4095
|
+
return false;
|
|
4096
|
+
// why: Ctrl+K trên Mac là phím sửa dòng của ô nhập — chỉ nhận ⌘K ở đó, và Ctrl+K ở nền tảng khác.
|
|
4097
|
+
return this.#applePlatform ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey;
|
|
4098
|
+
}
|
|
4099
|
+
#clearQuery() {
|
|
4100
|
+
this.searchText.set('');
|
|
4101
|
+
this.#focusRequest.set(0);
|
|
4102
|
+
// why: cây hiện lại thay cho kết quả — bắt đầu từ đầu list thay vì giữ vị trí cuộn của danh sách kết quả.
|
|
4103
|
+
this.list().nativeElement.scrollTop = 0;
|
|
4104
|
+
}
|
|
4105
|
+
#setCollapsed(collapsed) {
|
|
4106
|
+
this.isCollapsed.set(collapsed);
|
|
4107
|
+
this.#navigationState.patchVersionState(3, { collapsed });
|
|
4108
|
+
}
|
|
4109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV4, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarV4, isStandalone: true, selector: "sd-sidebar-v4", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "document:keydown": "onDocumentKeydown($event)" }, properties: { "class.sd-sidebar-v4--collapsed": "isCollapsed()", "class.sd-sidebar-v4--soft": "configuration().itemShape === \"soft\"", "class.sd-sidebar-v4--comfortable": "configuration().density === \"comfortable\"" }, classAttribute: "sd-sidebar-v4" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "mainTree", first: true, predicate: ["mainTree"], descendants: true, isSignal: true }, { propertyName: "headerSwitcher", first: true, predicate: ["headerSwitcher"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _collapsed = isCollapsed();\n@let _configuration = configuration();\n@let _query = searchText();\n@let _hasQuery = hasQuery();\n@let _focused = focusedResultIndex();\n@let _hasResults = _focused >= 0;\n@let _pinned = pinnedMenus();\n@let _recent = recentMenus();\n@let _showShortcuts = !_collapsed && !_hasQuery;\n@let _showPinned = _showShortcuts && _pinned.length > 0;\n@let _showRecent = _showShortcuts && recentConfiguration().enabled && _recent.length > 0;\n@let _toggleLabel = (_collapsed ? 'core.module.layout.sidebar.expand' : 'core.module.layout.sidebar.collapse') | sdTranslate;\n@let _searchLabel = 'core.module.layout.sidebar.v4-search-placeholder' | sdTranslate;\n<aside #asideElement data-v4-sidebar class=\"sd-sidebar-v4__drawer\" [attr.data-collapsed]=\"_collapsed\">\n <header\n #headerElement\n data-v4-header\n class=\"sd-sidebar-v4__header\"\n [class.sd-sidebar-v4__header--context-open]=\"!_collapsed && contextOpen()\">\n <span data-v4-logo class=\"sd-sidebar-v4__logo\" [class.sd-sidebar-v4__logo--image]=\"!!_configuration.logoUrl\" aria-hidden=\"true\">\n @if (_configuration.logoUrl) {\n <img [src]=\"_configuration.logoUrl\" alt=\"\" />\n } @else {\n {{ logoInitial() }}\n }\n </span>\n @if (!_collapsed) {\n <div data-v4-brand class=\"sd-sidebar-v4__brand\">\n <span data-v4-title class=\"sd-sidebar-v4__title\">{{ title() }}</span>\n @if (_configuration.context) {\n <sd-layout-context-switcher\n #headerSwitcher\n appearance=\"header\"\n [configuration]=\"_configuration.context\"\n [anchor]=\"headerElement\" />\n }\n </div>\n } @else if (_configuration.context) {\n <sd-layout-context-switcher\n class=\"sd-sidebar-v4__rail-context\"\n appearance=\"rail\"\n [configuration]=\"_configuration.context\"\n [anchor]=\"asideElement\" />\n }\n <!-- The same button stays mounted in both modes so focus survives a toggle. -->\n <button\n type=\"button\"\n data-v4-toggle\n class=\"sd-sidebar-v4__icon-button\"\n [attr.aria-label]=\"_toggleLabel\"\n [attr.aria-expanded]=\"!_collapsed\"\n [attr.title]=\"_toggleLabel\"\n (click)=\"toggleCollapsed()\">\n <sd-icon [name]=\"_collapsed ? 'menu' : 'menu_open'\" size=\"20px\"></sd-icon>\n </button>\n @if (_collapsed) {\n <button\n type=\"button\"\n data-v4-rail-search\n class=\"sd-sidebar-v4__icon-button\"\n [attr.aria-label]=\"_searchLabel\"\n [attr.title]=\"_searchLabel\"\n (click)=\"focusSearch()\">\n <sd-icon name=\"search\" size=\"20px\"></sd-icon>\n </button>\n }\n </header>\n\n @if (!_collapsed) {\n <div data-v4-search class=\"sd-sidebar-v4__search\">\n <div data-v4-search-field class=\"sd-sidebar-v4__search-field\" [class.sd-sidebar-v4__search-field--filled]=\"!!_query\">\n <sd-icon class=\"sd-sidebar-v4__search-icon\" name=\"search\" size=\"20px\" aria-hidden=\"true\"></sd-icon>\n <input\n #searchInput\n data-v4-search-input\n class=\"sd-sidebar-v4__search-input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n [attr.aria-label]=\"_searchLabel\"\n [attr.placeholder]=\"_searchLabel\"\n [attr.aria-keyshortcuts]=\"shortcutKeys\"\n [attr.aria-expanded]=\"_hasResults\"\n [attr.aria-controls]=\"_hasResults ? mainTree.resultsId : null\"\n [attr.aria-activedescendant]=\"_hasResults ? mainTree.resultOptionId(_focused) : null\"\n [value]=\"_query\"\n (input)=\"onSearchInput($event)\"\n (keydown)=\"onSearchKeydown($event)\" />\n @if (_query) {\n <button\n type=\"button\"\n data-v4-search-clear\n class=\"sd-sidebar-v4__search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\"></sd-icon>\n </button>\n } @else {\n <kbd data-v4-search-shortcut class=\"sd-sidebar-v4__search-shortcut\" aria-hidden=\"true\">{{ shortcutHint }}</kbd>\n }\n </div>\n </div>\n }\n\n <nav #list data-v4-nav class=\"sd-sidebar-v4__list\" [attr.aria-label]=\"'core.module.layout.sidebar.primary-nav' | sdTranslate\">\n @if (_showPinned) {\n <section data-v4-pinned class=\"sd-sidebar-v4__shortcuts\">\n <h2 class=\"sd-sidebar-v4__section-label\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"_pinned\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\" />\n </section>\n }\n @if (_showRecent) {\n <section data-v4-recent class=\"sd-sidebar-v4__shortcuts\">\n <h2 class=\"sd-sidebar-v4__section-label\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"_recent\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\" />\n </section>\n }\n <!-- One tree instance for hierarchy, results and rail: its live region must stay mounted to announce result counts. -->\n <sd-sidebar-v4-menu-tree\n #mainTree\n data-v4-tree\n [class.sd-sidebar-v4__tree--separated]=\"(_showPinned || _showRecent) && leadsWithUnsectioned()\"\n [menus]=\"menus()\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [presentation]=\"_hasQuery && !_collapsed ? 'results' : 'hierarchy'\"\n [mode]=\"_collapsed ? 'collapsed' : 'expanded'\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [pinnedKeys]=\"pinnedKeys()\"\n [collapsedGroup]=\"_configuration.collapsedGroup\"\n [query]=\"_query\"\n [focusedIndex]=\"_focused\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\"\n (expandGroup)=\"activateCollapsedMenu($event)\" />\n </nav>\n\n <div data-v4-footer class=\"sd-sidebar-v4__footer\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"_collapsed\"></sd-layout-user-menu>\n </div>\n</aside>\n\n<main data-v4-content class=\"sd-sidebar-v4__content\">\n <ng-content></ng-content>\n</main>\n", styles: [":host{--sd-sidebar-v4-width: 280px;--sd-sidebar-v4-rail-width: 72px;--sd-sidebar-v4-item-height: 36px;--sd-sidebar-v4-child-height: 32px;--sd-sidebar-v4-item-radius: 999px;--sd-layout-context-switcher-popover-width: calc(var(--sd-sidebar-v4-width) - 24px);--sidebar-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--sd-layout-context-switcher-dot-ring-color: var(--sidebar-bg);--sidebar-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--sidebar-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--sidebar-muted-ink: var(--sd-text-secondary);--sidebar-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));display:block;min-height:100vh}:host(.sd-sidebar-v4--comfortable){--sd-sidebar-v4-item-height: 40px;--sd-sidebar-v4-child-height: 34px}:host(.sd-sidebar-v4--soft){--sd-sidebar-v4-item-radius: 8px}.sd-sidebar-v4__drawer{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 0;display:flex;flex-direction:column;box-sizing:border-box;width:var(--sd-sidebar-v4-width);border-right:1px solid var(--sidebar-line);background:var(--sidebar-bg);color:var(--sd-text);transition:width .16s ease}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__drawer{width:var(--sd-sidebar-v4-rail-width)}.sd-sidebar-v4__content{min-height:100vh;margin-left:var(--sd-sidebar-v4-width);transition:margin-left .16s ease}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__content{margin-left:var(--sd-sidebar-v4-rail-width)}.sd-sidebar-v4__header{display:flex;flex:none;align-items:center;gap:var(--sd-space-12, 12px);box-sizing:border-box;height:64px;padding:0 12px 0 16px}.sd-sidebar-v4__header--context-open{border-radius:var(--sd-radius-12, 12px);background:var(--sidebar-hover-bg)}.sd-sidebar-v4__header--context-open ::ng-deep .sd-layout-context-switcher__trigger.sd-layout-context-switcher__trigger--header{background:transparent}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__header{flex-direction:column;gap:0;height:auto;padding:18px 0 6px}.sd-sidebar-v4__logo{display:inline-flex;flex:none;align-items:center;justify-content:center;overflow:hidden;width:28px;height:28px;border-radius:var(--sd-radius-8, 8px);background:var(--sd-primary);color:var(--sd-primary-contrast);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-bold, 700);line-height:1}.sd-sidebar-v4__logo img{width:100%;height:100%;object-fit:contain}.sd-sidebar-v4__logo--image{background:transparent}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__logo{margin-bottom:18px}.sd-sidebar-v4__rail-context:not(:empty){margin:-6px 0 12px}.sd-sidebar-v4__brand{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.sd-sidebar-v4__title{overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-v4__icon-button,.sd-sidebar-v4__search-clear{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;margin:0;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sidebar-muted-ink);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4__icon-button:hover,.sd-sidebar-v4__search-clear:hover{background:var(--sidebar-hover-bg)}.sd-sidebar-v4__icon-button:focus-visible,.sd-sidebar-v4__search-clear:focus-visible{outline:none;box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-v4__icon-button{width:40px;height:40px}.sd-sidebar-v4__search{flex:none;padding:0 12px 6px}.sd-sidebar-v4__search-field{display:flex;align-items:center;gap:var(--sd-space-8, 8px);box-sizing:border-box;height:36px;padding:0 8px 0 12px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-border) 50%,var(--sd-surface));color:var(--sidebar-muted-ink)}.sd-sidebar-v4__search-field:focus-within{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-v4__search-field--filled,.sd-sidebar-v4__search-field--filled:focus-within{box-shadow:inset 0 0 0 2px var(--sd-primary)}.sd-sidebar-v4__search-icon{flex:none}.sd-sidebar-v4__search-input{flex:1 1 auto;min-width:0;height:100%;margin:0;padding:0;border:0;outline:0;background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px)}.sd-sidebar-v4__search-input::placeholder{color:var(--sidebar-muted-ink);opacity:1}.sd-sidebar-v4__search-clear{width:28px;height:28px}.sd-sidebar-v4__search-shortcut{flex:none;padding:1px 5px;border:1px solid color-mix(in srgb,var(--sd-border) 70%,var(--sd-surface));border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface);color:var(--sidebar-muted-ink);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-16, 16px);white-space:nowrap}.sd-sidebar-v4__list{flex:1 1 auto;min-height:0;box-sizing:border-box;padding:0 12px 12px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__list{padding:0 0 12px}.sd-sidebar-v4__section-label{margin:0;padding:14px 12px 4px;color:var(--sidebar-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-sidebar-v4__tree--separated{margin-top:var(--sd-space-16, 16px)}.sd-sidebar-v4__footer{flex:none;box-sizing:border-box;padding:12px 8px 12px 16px;border-top:1px solid var(--sidebar-line)}:host(:not(.sd-sidebar-v4--collapsed)) .sd-sidebar-v4__footer ::ng-deep .sd-layout-user-menu__popup{box-sizing:border-box;left:-4px;width:calc(var(--sd-sidebar-v4-width) - 24px)}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__footer{display:flex;justify-content:center;padding:6px 0}@media(pointer:coarse){:host,:host(.sd-sidebar-v4--comfortable){--sd-sidebar-v4-item-height: 44px;--sd-sidebar-v4-child-height: 44px}.sd-sidebar-v4__icon-button,.sd-sidebar-v4__search-clear{width:44px;height:44px}.sd-sidebar-v4__search-field{height:44px;padding-right:0}.sd-sidebar-v4__search-shortcut{display:none}}@media(prefers-reduced-motion:reduce){.sd-sidebar-v4__drawer,.sd-sidebar-v4__content,.sd-sidebar-v4__icon-button,.sd-sidebar-v4__search-clear{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "component", type: SdSidebarV4MenuTree, selector: "sd-sidebar-v4-menu-tree", inputs: ["menus", "pathSource", "activePath", "presentation", "mode", "collapsedGroupKeys", "pinnedKeys", "showPin", "collapsedGroup", "query", "focusedIndex"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned", "expandGroup"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4111
|
+
}
|
|
4112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarV4, decorators: [{
|
|
4113
|
+
type: Component,
|
|
4114
|
+
args: [{ selector: 'sd-sidebar-v4', standalone: true, imports: [SdIcon, SdLayoutContextSwitcher, SdLayoutUserMenuComponent, SdSidebarV4MenuTree, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
4115
|
+
class: 'sd-sidebar-v4',
|
|
4116
|
+
'[class.sd-sidebar-v4--collapsed]': 'isCollapsed()',
|
|
4117
|
+
'[class.sd-sidebar-v4--soft]': 'configuration().itemShape === "soft"',
|
|
4118
|
+
'[class.sd-sidebar-v4--comfortable]': 'configuration().density === "comfortable"',
|
|
4119
|
+
'(document:keydown)': 'onDocumentKeydown($event)',
|
|
4120
|
+
}, template: "@let _collapsed = isCollapsed();\n@let _configuration = configuration();\n@let _query = searchText();\n@let _hasQuery = hasQuery();\n@let _focused = focusedResultIndex();\n@let _hasResults = _focused >= 0;\n@let _pinned = pinnedMenus();\n@let _recent = recentMenus();\n@let _showShortcuts = !_collapsed && !_hasQuery;\n@let _showPinned = _showShortcuts && _pinned.length > 0;\n@let _showRecent = _showShortcuts && recentConfiguration().enabled && _recent.length > 0;\n@let _toggleLabel = (_collapsed ? 'core.module.layout.sidebar.expand' : 'core.module.layout.sidebar.collapse') | sdTranslate;\n@let _searchLabel = 'core.module.layout.sidebar.v4-search-placeholder' | sdTranslate;\n<aside #asideElement data-v4-sidebar class=\"sd-sidebar-v4__drawer\" [attr.data-collapsed]=\"_collapsed\">\n <header\n #headerElement\n data-v4-header\n class=\"sd-sidebar-v4__header\"\n [class.sd-sidebar-v4__header--context-open]=\"!_collapsed && contextOpen()\">\n <span data-v4-logo class=\"sd-sidebar-v4__logo\" [class.sd-sidebar-v4__logo--image]=\"!!_configuration.logoUrl\" aria-hidden=\"true\">\n @if (_configuration.logoUrl) {\n <img [src]=\"_configuration.logoUrl\" alt=\"\" />\n } @else {\n {{ logoInitial() }}\n }\n </span>\n @if (!_collapsed) {\n <div data-v4-brand class=\"sd-sidebar-v4__brand\">\n <span data-v4-title class=\"sd-sidebar-v4__title\">{{ title() }}</span>\n @if (_configuration.context) {\n <sd-layout-context-switcher\n #headerSwitcher\n appearance=\"header\"\n [configuration]=\"_configuration.context\"\n [anchor]=\"headerElement\" />\n }\n </div>\n } @else if (_configuration.context) {\n <sd-layout-context-switcher\n class=\"sd-sidebar-v4__rail-context\"\n appearance=\"rail\"\n [configuration]=\"_configuration.context\"\n [anchor]=\"asideElement\" />\n }\n <!-- The same button stays mounted in both modes so focus survives a toggle. -->\n <button\n type=\"button\"\n data-v4-toggle\n class=\"sd-sidebar-v4__icon-button\"\n [attr.aria-label]=\"_toggleLabel\"\n [attr.aria-expanded]=\"!_collapsed\"\n [attr.title]=\"_toggleLabel\"\n (click)=\"toggleCollapsed()\">\n <sd-icon [name]=\"_collapsed ? 'menu' : 'menu_open'\" size=\"20px\"></sd-icon>\n </button>\n @if (_collapsed) {\n <button\n type=\"button\"\n data-v4-rail-search\n class=\"sd-sidebar-v4__icon-button\"\n [attr.aria-label]=\"_searchLabel\"\n [attr.title]=\"_searchLabel\"\n (click)=\"focusSearch()\">\n <sd-icon name=\"search\" size=\"20px\"></sd-icon>\n </button>\n }\n </header>\n\n @if (!_collapsed) {\n <div data-v4-search class=\"sd-sidebar-v4__search\">\n <div data-v4-search-field class=\"sd-sidebar-v4__search-field\" [class.sd-sidebar-v4__search-field--filled]=\"!!_query\">\n <sd-icon class=\"sd-sidebar-v4__search-icon\" name=\"search\" size=\"20px\" aria-hidden=\"true\"></sd-icon>\n <input\n #searchInput\n data-v4-search-input\n class=\"sd-sidebar-v4__search-input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n [attr.aria-label]=\"_searchLabel\"\n [attr.placeholder]=\"_searchLabel\"\n [attr.aria-keyshortcuts]=\"shortcutKeys\"\n [attr.aria-expanded]=\"_hasResults\"\n [attr.aria-controls]=\"_hasResults ? mainTree.resultsId : null\"\n [attr.aria-activedescendant]=\"_hasResults ? mainTree.resultOptionId(_focused) : null\"\n [value]=\"_query\"\n (input)=\"onSearchInput($event)\"\n (keydown)=\"onSearchKeydown($event)\" />\n @if (_query) {\n <button\n type=\"button\"\n data-v4-search-clear\n class=\"sd-sidebar-v4__search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\"></sd-icon>\n </button>\n } @else {\n <kbd data-v4-search-shortcut class=\"sd-sidebar-v4__search-shortcut\" aria-hidden=\"true\">{{ shortcutHint }}</kbd>\n }\n </div>\n </div>\n }\n\n <nav #list data-v4-nav class=\"sd-sidebar-v4__list\" [attr.aria-label]=\"'core.module.layout.sidebar.primary-nav' | sdTranslate\">\n @if (_showPinned) {\n <section data-v4-pinned class=\"sd-sidebar-v4__shortcuts\">\n <h2 class=\"sd-sidebar-v4__section-label\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"_pinned\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\" />\n </section>\n }\n @if (_showRecent) {\n <section data-v4-recent class=\"sd-sidebar-v4__shortcuts\">\n <h2 class=\"sd-sidebar-v4__section-label\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n [menus]=\"_recent\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\" />\n </section>\n }\n <!-- One tree instance for hierarchy, results and rail: its live region must stay mounted to announce result counts. -->\n <sd-sidebar-v4-menu-tree\n #mainTree\n data-v4-tree\n [class.sd-sidebar-v4__tree--separated]=\"(_showPinned || _showRecent) && leadsWithUnsectioned()\"\n [menus]=\"menus()\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [presentation]=\"_hasQuery && !_collapsed ? 'results' : 'hierarchy'\"\n [mode]=\"_collapsed ? 'collapsed' : 'expanded'\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [pinnedKeys]=\"pinnedKeys()\"\n [collapsedGroup]=\"_configuration.collapsedGroup\"\n [query]=\"_query\"\n [focusedIndex]=\"_focused\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\"\n (expandGroup)=\"activateCollapsedMenu($event)\" />\n </nav>\n\n <div data-v4-footer class=\"sd-sidebar-v4__footer\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\" [compact]=\"_collapsed\"></sd-layout-user-menu>\n </div>\n</aside>\n\n<main data-v4-content class=\"sd-sidebar-v4__content\">\n <ng-content></ng-content>\n</main>\n", styles: [":host{--sd-sidebar-v4-width: 280px;--sd-sidebar-v4-rail-width: 72px;--sd-sidebar-v4-item-height: 36px;--sd-sidebar-v4-child-height: 32px;--sd-sidebar-v4-item-radius: 999px;--sd-layout-context-switcher-popover-width: calc(var(--sd-sidebar-v4-width) - 24px);--sidebar-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--sd-layout-context-switcher-dot-ring-color: var(--sidebar-bg);--sidebar-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--sidebar-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--sidebar-muted-ink: var(--sd-text-secondary);--sidebar-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));display:block;min-height:100vh}:host(.sd-sidebar-v4--comfortable){--sd-sidebar-v4-item-height: 40px;--sd-sidebar-v4-child-height: 34px}:host(.sd-sidebar-v4--soft){--sd-sidebar-v4-item-radius: 8px}.sd-sidebar-v4__drawer{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:0 auto 0 0;display:flex;flex-direction:column;box-sizing:border-box;width:var(--sd-sidebar-v4-width);border-right:1px solid var(--sidebar-line);background:var(--sidebar-bg);color:var(--sd-text);transition:width .16s ease}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__drawer{width:var(--sd-sidebar-v4-rail-width)}.sd-sidebar-v4__content{min-height:100vh;margin-left:var(--sd-sidebar-v4-width);transition:margin-left .16s ease}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__content{margin-left:var(--sd-sidebar-v4-rail-width)}.sd-sidebar-v4__header{display:flex;flex:none;align-items:center;gap:var(--sd-space-12, 12px);box-sizing:border-box;height:64px;padding:0 12px 0 16px}.sd-sidebar-v4__header--context-open{border-radius:var(--sd-radius-12, 12px);background:var(--sidebar-hover-bg)}.sd-sidebar-v4__header--context-open ::ng-deep .sd-layout-context-switcher__trigger.sd-layout-context-switcher__trigger--header{background:transparent}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__header{flex-direction:column;gap:0;height:auto;padding:18px 0 6px}.sd-sidebar-v4__logo{display:inline-flex;flex:none;align-items:center;justify-content:center;overflow:hidden;width:28px;height:28px;border-radius:var(--sd-radius-8, 8px);background:var(--sd-primary);color:var(--sd-primary-contrast);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-bold, 700);line-height:1}.sd-sidebar-v4__logo img{width:100%;height:100%;object-fit:contain}.sd-sidebar-v4__logo--image{background:transparent}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__logo{margin-bottom:18px}.sd-sidebar-v4__rail-context:not(:empty){margin:-6px 0 12px}.sd-sidebar-v4__brand{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.sd-sidebar-v4__title{overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-v4__icon-button,.sd-sidebar-v4__search-clear{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;margin:0;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sidebar-muted-ink);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-v4__icon-button:hover,.sd-sidebar-v4__search-clear:hover{background:var(--sidebar-hover-bg)}.sd-sidebar-v4__icon-button:focus-visible,.sd-sidebar-v4__search-clear:focus-visible{outline:none;box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-v4__icon-button{width:40px;height:40px}.sd-sidebar-v4__search{flex:none;padding:0 12px 6px}.sd-sidebar-v4__search-field{display:flex;align-items:center;gap:var(--sd-space-8, 8px);box-sizing:border-box;height:36px;padding:0 8px 0 12px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-border) 50%,var(--sd-surface));color:var(--sidebar-muted-ink)}.sd-sidebar-v4__search-field:focus-within{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-v4__search-field--filled,.sd-sidebar-v4__search-field--filled:focus-within{box-shadow:inset 0 0 0 2px var(--sd-primary)}.sd-sidebar-v4__search-icon{flex:none}.sd-sidebar-v4__search-input{flex:1 1 auto;min-width:0;height:100%;margin:0;padding:0;border:0;outline:0;background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px)}.sd-sidebar-v4__search-input::placeholder{color:var(--sidebar-muted-ink);opacity:1}.sd-sidebar-v4__search-clear{width:28px;height:28px}.sd-sidebar-v4__search-shortcut{flex:none;padding:1px 5px;border:1px solid color-mix(in srgb,var(--sd-border) 70%,var(--sd-surface));border-radius:var(--sd-radius-6, 6px);background:var(--sd-surface);color:var(--sidebar-muted-ink);font-family:Roboto Mono,ui-monospace,monospace;font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-16, 16px);white-space:nowrap}.sd-sidebar-v4__list{flex:1 1 auto;min-height:0;box-sizing:border-box;padding:0 12px 12px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__list{padding:0 0 12px}.sd-sidebar-v4__section-label{margin:0;padding:14px 12px 4px;color:var(--sidebar-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-sidebar-v4__tree--separated{margin-top:var(--sd-space-16, 16px)}.sd-sidebar-v4__footer{flex:none;box-sizing:border-box;padding:12px 8px 12px 16px;border-top:1px solid var(--sidebar-line)}:host(:not(.sd-sidebar-v4--collapsed)) .sd-sidebar-v4__footer ::ng-deep .sd-layout-user-menu__popup{box-sizing:border-box;left:-4px;width:calc(var(--sd-sidebar-v4-width) - 24px)}:host(.sd-sidebar-v4--collapsed) .sd-sidebar-v4__footer{display:flex;justify-content:center;padding:6px 0}@media(pointer:coarse){:host,:host(.sd-sidebar-v4--comfortable){--sd-sidebar-v4-item-height: 44px;--sd-sidebar-v4-child-height: 44px}.sd-sidebar-v4__icon-button,.sd-sidebar-v4__search-clear{width:44px;height:44px}.sd-sidebar-v4__search-field{height:44px;padding-right:0}.sd-sidebar-v4__search-shortcut{display:none}}@media(prefers-reduced-motion:reduce){.sd-sidebar-v4__drawer,.sd-sidebar-v4__content,.sd-sidebar-v4__icon-button,.sd-sidebar-v4__search-clear{transition:none}}\n"] }]
|
|
4121
|
+
}], ctorParameters: () => [], propDecorators: { searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], list: [{ type: i0.ViewChild, args: ['list', { isSignal: true }] }], mainTree: [{ type: i0.ViewChild, args: ['mainTree', { isSignal: true }] }], headerSwitcher: [{ type: i0.ViewChild, args: ['headerSwitcher', { isSignal: true }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }] } });
|
|
4122
|
+
function isApplePlatform(navigator) {
|
|
4123
|
+
const userAgentData = navigator?.userAgentData;
|
|
4124
|
+
return /mac|iphone|ipad|ipod/i.test(userAgentData?.platform || navigator?.platform || '');
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4127
|
+
let nextMobileV4Id = 0;
|
|
4128
|
+
/**
|
|
4129
|
+
* Sidebar V4 mobile shell (README M1–M3): a 56px app bar, a `min(88vw, 360px)` modal drawer that hosts the V4 menu tree in
|
|
4130
|
+
* `mobile` mode (44px rows, combobox search, Pinned/Recent, account footer, Context Switcher bottom sheet) and an opt-in
|
|
4131
|
+
* bottom bar built from `mobile.bottomBar` (at most 4 menu ids plus "More"). Routed content is projected into `<main>`.
|
|
4132
|
+
*
|
|
4133
|
+
* Navigation, pinned and recent behave like `sd-sidebar-v4`. Every way of closing the drawer (backdrop, Escape, menu
|
|
4134
|
+
* selection, including the page already open) clears the search and returns focus to the control that opened it (INV-011).
|
|
4135
|
+
* Options are read only after `normalizeSidebarConfiguration` (INV-012). Mobile has no rail, so the collapse preference is
|
|
4136
|
+
* never read or written. With `context` configured, `context.items` reach `SdLayoutContextService.syncItems()` on init,
|
|
4137
|
+
* before the drawer and its switcher first render; without it the context service is never created.
|
|
4138
|
+
*/
|
|
4139
|
+
class SdSidebarMobileV4 {
|
|
4140
|
+
#router = inject(Router);
|
|
4141
|
+
#document = inject(DOCUMENT);
|
|
4142
|
+
#destroyRef = inject(DestroyRef);
|
|
4143
|
+
#injector = inject(Injector);
|
|
4144
|
+
#navigationState = inject(SdLayoutNavigationStateService);
|
|
4145
|
+
#id = `sd-sidebar-mobile-v4-${nextMobileV4Id++}`;
|
|
4146
|
+
/** Requested result index; `focusedResultIndex` clamps it to the current results. */
|
|
4147
|
+
#focusRequest = signal(0, /* @ts-ignore */
|
|
4148
|
+
...(ngDevMode ? [{ debugName: "#focusRequest" }] : /* istanbul ignore next */ []));
|
|
4149
|
+
#restoreFocusElement = null;
|
|
4150
|
+
#previousBodyOverflow = '';
|
|
4151
|
+
trigger = viewChild('trigger', /* @ts-ignore */
|
|
4152
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
4153
|
+
searchInput = viewChild('searchInput', /* @ts-ignore */
|
|
4154
|
+
...(ngDevMode ? [{ debugName: "searchInput" }] : /* istanbul ignore next */ []));
|
|
4155
|
+
list = viewChild('list', /* @ts-ignore */
|
|
4156
|
+
...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
|
|
4157
|
+
mainTree = viewChild('mainTree', /* @ts-ignore */
|
|
4158
|
+
...(ngDevMode ? [{ debugName: "mainTree" }] : /* istanbul ignore next */ []));
|
|
4159
|
+
menus = input([], /* @ts-ignore */
|
|
4160
|
+
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
4161
|
+
userInfo = input.required(/* @ts-ignore */
|
|
4162
|
+
...(ngDevMode ? [{ debugName: "userInfo" }] : /* istanbul ignore next */ []));
|
|
4163
|
+
sidebar = input.required(/* @ts-ignore */
|
|
4164
|
+
...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
|
|
4165
|
+
/** `sidebar()` with the V4 defaults filled by `normalizeSidebarConfiguration`, the only place they are resolved (INV-012). */
|
|
4166
|
+
configuration = computed(() => normalizeSidebarConfiguration(this.sidebar()), /* @ts-ignore */
|
|
4167
|
+
...(ngDevMode ? [{ debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
4168
|
+
isDrawerOpen = signal(false, /* @ts-ignore */
|
|
4169
|
+
...(ngDevMode ? [{ debugName: "isDrawerOpen" }] : /* istanbul ignore next */ []));
|
|
4170
|
+
searchText = signal('', /* @ts-ignore */
|
|
4171
|
+
...(ngDevMode ? [{ debugName: "searchText" }] : /* istanbul ignore next */ []));
|
|
4172
|
+
activePath = signal(this.#router.url.split(/[?#]/, 1)[0] ?? '', /* @ts-ignore */
|
|
4173
|
+
...(ngDevMode ? [{ debugName: "activePath" }] : /* istanbul ignore next */ []));
|
|
4174
|
+
collapsedGroupKeys = signal([], /* @ts-ignore */
|
|
4175
|
+
...(ngDevMode ? [{ debugName: "collapsedGroupKeys" }] : /* istanbul ignore next */ []));
|
|
4176
|
+
/** The drawer was opened from the app-bar search button: its search input takes the initial focus. */
|
|
4177
|
+
focusSearchOnOpen = signal(false, /* @ts-ignore */
|
|
4178
|
+
...(ngDevMode ? [{ debugName: "focusSearchOnOpen" }] : /* istanbul ignore next */ []));
|
|
4179
|
+
/** Search results in the order the tree renders its options (accent-insensitive, without `comingSoon` items). */
|
|
4180
|
+
searchResults = computed(() => buildSidebarV4SearchResults(this.menus(), this.searchText()), /* @ts-ignore */
|
|
4181
|
+
...(ngDevMode ? [{ debugName: "searchResults" }] : /* istanbul ignore next */ []));
|
|
4182
|
+
/** Index of the keyboard-selected result: the first one when results appear, -1 when there is none. */
|
|
4183
|
+
focusedResultIndex = computed(() => {
|
|
4184
|
+
const count = this.searchResults().length;
|
|
4185
|
+
return count ? Math.min(Math.max(this.#focusRequest(), 0), count - 1) : -1;
|
|
4186
|
+
}, /* @ts-ignore */
|
|
4187
|
+
...(ngDevMode ? [{ debugName: "focusedResultIndex" }] : /* istanbul ignore next */ []));
|
|
4188
|
+
recentConfiguration = computed(() => this.configuration().recent, /* @ts-ignore */
|
|
4189
|
+
...(ngDevMode ? [{ debugName: "recentConfiguration" }] : /* istanbul ignore next */ []));
|
|
4190
|
+
pinnedKeys = this.#navigationState.pinnedKeys;
|
|
4191
|
+
pinnedMenus = this.#navigationState.pinnedMenus;
|
|
4192
|
+
recentMenus = this.#navigationState.recentMenus;
|
|
4193
|
+
titleId = `${this.#id}-title`;
|
|
4194
|
+
hasQuery = computed(() => !!this.searchText().trim(), /* @ts-ignore */
|
|
4195
|
+
...(ngDevMode ? [{ debugName: "hasQuery" }] : /* istanbul ignore next */ []));
|
|
4196
|
+
title = computed(() => this.configuration().defaultTitle || 'Back Office', /* @ts-ignore */
|
|
4197
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
4198
|
+
logoInitial = computed(() => Array.from(this.title().trim())[0]?.toLocaleUpperCase() ?? '', /* @ts-ignore */
|
|
4199
|
+
...(ngDevMode ? [{ debugName: "logoInitial" }] : /* istanbul ignore next */ []));
|
|
4200
|
+
/** The hierarchy starts with items that have no section heading. */
|
|
4201
|
+
leadsWithUnsectioned = computed(() => groupMenusBySection(this.menus())[0]?.section === null, /* @ts-ignore */
|
|
4202
|
+
...(ngDevMode ? [{ debugName: "leadsWithUnsectioned" }] : /* istanbul ignore next */ []));
|
|
4203
|
+
displayName = computed(() => {
|
|
4204
|
+
const user = this.userInfo();
|
|
4205
|
+
return user.fullName || user.username || user.email || '';
|
|
4206
|
+
}, /* @ts-ignore */
|
|
4207
|
+
...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
|
|
4208
|
+
/** First letters of the first and last word of the display name, as on the README M1 avatar. */
|
|
4209
|
+
userInitials = computed(() => {
|
|
4210
|
+
const words = this.displayName().trim().split(/\s+/).filter(Boolean);
|
|
4211
|
+
const first = Array.from(words[0] ?? '')[0] ?? '';
|
|
4212
|
+
const last = words.length > 1 ? (Array.from(words[words.length - 1])[0] ?? '') : '';
|
|
4213
|
+
return (first + last).toLocaleUpperCase();
|
|
4214
|
+
}, /* @ts-ignore */
|
|
4215
|
+
...(ngDevMode ? [{ debugName: "userInitials" }] : /* istanbul ignore next */ []));
|
|
4216
|
+
/** Menus of `mobile.bottomBar` that exist in `menus` (looked up by `id` at any depth), in configured order. */
|
|
4217
|
+
destinations = computed(() => {
|
|
4218
|
+
const ids = this.configuration().mobile?.bottomBar ?? [];
|
|
4219
|
+
if (!ids.length)
|
|
4220
|
+
return [];
|
|
4221
|
+
const menus = this.menus();
|
|
4222
|
+
const entries = indexMenusById(menus);
|
|
4223
|
+
const activeMenuPath = resolveActiveMenuPath(menus, this.activePath());
|
|
4224
|
+
return ids
|
|
4225
|
+
.map(id => entries.get(id))
|
|
4226
|
+
.filter((entry) => !!entry)
|
|
4227
|
+
.map((entry, index) => {
|
|
4228
|
+
const { menu, key } = entry;
|
|
4229
|
+
const isGroup = 'children' in menu && Array.isArray(menu.children) && menu.children.length > 0;
|
|
4230
|
+
const path = 'path' in menu && typeof menu.path === 'string' ? menu.path : '';
|
|
4231
|
+
const trailing = resolveMenuTrailing(menu);
|
|
4232
|
+
const live = trailing?.kind === 'status' && trailing.live ? trailing : null;
|
|
4233
|
+
return {
|
|
4234
|
+
menu,
|
|
4235
|
+
key,
|
|
4236
|
+
label: menu.tooltipTitle || menu.title || '',
|
|
4237
|
+
isGroup,
|
|
4238
|
+
isActive: !!activeMenuPath && (isGroup ? containsMenuPath(menu, activeMenuPath) : path === activeMenuPath),
|
|
4239
|
+
disabled: menu.comingSoon === true,
|
|
4240
|
+
expandKeys: [...entry.ancestorKeys, key],
|
|
4241
|
+
badge: trailing?.kind === 'badge' ? { value: trailing.value, tone: trailing.tone } : null,
|
|
4242
|
+
liveTone: live?.tone ?? null,
|
|
4243
|
+
liveLabel: live?.label ?? '',
|
|
4244
|
+
descriptionId: `${this.#id}-destination-${index}`,
|
|
4245
|
+
};
|
|
4246
|
+
});
|
|
4247
|
+
}, /* @ts-ignore */
|
|
4248
|
+
...(ngDevMode ? [{ debugName: "destinations" }] : /* istanbul ignore next */ []));
|
|
4249
|
+
constructor() {
|
|
4250
|
+
effect(() => {
|
|
4251
|
+
const menus = this.menus();
|
|
4252
|
+
const maximum = this.configuration().recent.maxItems;
|
|
4253
|
+
untracked(() => this.#navigationState.hydrate(menus, maximum));
|
|
4254
|
+
});
|
|
4255
|
+
// why: switcher chỉ mount khi drawer mở — đối chiếu context ngay lúc khởi tạo (D-021) để listener nhiều tab chạy từ
|
|
4256
|
+
// đầu và lần chạm đầu vào menu không kích reload đối chiếu. Không có `context` thì không lấy service: app không cấu
|
|
4257
|
+
// hình context không tạo service lẫn listener.
|
|
4258
|
+
effect(() => {
|
|
4259
|
+
const context = this.configuration().context;
|
|
4260
|
+
if (!context)
|
|
4261
|
+
return;
|
|
4262
|
+
const items = context.items;
|
|
4263
|
+
untracked(() => this.#injector.get(SdLayoutContextService).syncItems(items));
|
|
4264
|
+
});
|
|
4265
|
+
this.#router.events.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
|
|
4266
|
+
if (event instanceof NavigationEnd) {
|
|
4267
|
+
this.activePath.set(event.urlAfterRedirects.split(/[?#]/, 1)[0] ?? '');
|
|
4268
|
+
this.closeFromNavigation();
|
|
4269
|
+
return;
|
|
4270
|
+
}
|
|
4271
|
+
// why: chọn đúng trang đang mở thì router bỏ qua (NavigationSkipped, navigate trả false) — vẫn là một lựa chọn menu
|
|
4272
|
+
// nên đóng drawer. Điều hướng bị guard huỷ (NavigationCancel) giữ drawer mở.
|
|
4273
|
+
if (event instanceof NavigationSkipped)
|
|
4274
|
+
this.closeFromNavigation();
|
|
4275
|
+
});
|
|
4276
|
+
effect(() => {
|
|
4277
|
+
const menus = this.menus();
|
|
4278
|
+
const activeMenuPath = resolveActiveMenuPath(menus, this.activePath());
|
|
4279
|
+
if (!activeMenuPath)
|
|
4280
|
+
return;
|
|
4281
|
+
const activeGroupKeys = new Set();
|
|
4282
|
+
const visit = (items, ancestors) => {
|
|
4283
|
+
for (const menu of items) {
|
|
4284
|
+
if (!('children' in menu) || !containsMenuPath(menu, activeMenuPath))
|
|
4285
|
+
continue;
|
|
4286
|
+
const key = getMenuStableKey(menu, ancestors);
|
|
4287
|
+
activeGroupKeys.add(key);
|
|
4288
|
+
visit(menu.children ?? [], [...ancestors, menu.title ?? key]);
|
|
4289
|
+
}
|
|
4290
|
+
};
|
|
4291
|
+
visit(menus, []);
|
|
4292
|
+
// why: Chỉ mở nhánh khi route/menu đổi; người dùng vẫn được đóng nhánh đang active.
|
|
4293
|
+
untracked(() => this.collapsedGroupKeys.update(keys => keys.filter(key => !activeGroupKeys.has(key))));
|
|
4294
|
+
});
|
|
4295
|
+
// why: chỉ trả lại overflow của body khi chính drawer đang khoá cuộn — không ghi đè giá trị phần khác đặt sau đó.
|
|
4296
|
+
this.#destroyRef.onDestroy(() => {
|
|
4297
|
+
if (this.isDrawerOpen())
|
|
4298
|
+
this.#releaseBodyScroll();
|
|
4299
|
+
});
|
|
4300
|
+
}
|
|
4301
|
+
/** Opens the drawer; focus returns to `trigger` (default: the focused element, else the app-bar menu button) on close. */
|
|
4302
|
+
openDrawer(trigger) {
|
|
4303
|
+
if (this.isDrawerOpen())
|
|
4304
|
+
return;
|
|
4305
|
+
const active = this.#document.activeElement;
|
|
4306
|
+
this.#restoreFocusElement =
|
|
4307
|
+
trigger instanceof HTMLElement
|
|
4308
|
+
? trigger
|
|
4309
|
+
: active instanceof HTMLElement && active !== this.#document.body
|
|
4310
|
+
? active
|
|
4311
|
+
: (this.trigger()?.nativeElement ?? null);
|
|
4312
|
+
// why: cdkTrapFocusAutoCapture trả focus về phần tử đang focus lúc mở khi drawer bị huỷ. Safari/iOS không focus nút
|
|
4313
|
+
// khi chạm, nên focus trigger trước để lần trả focus đó trùng trigger thay vì nhảy về phần tử khác trong trang.
|
|
4314
|
+
this.#restoreFocusElement?.focus({ preventScroll: true });
|
|
4315
|
+
this.#previousBodyOverflow = this.#document.body.style.overflow;
|
|
4316
|
+
this.#document.body.style.overflow = 'hidden';
|
|
4317
|
+
this.isDrawerOpen.set(true);
|
|
4318
|
+
}
|
|
4319
|
+
/** Opens the drawer with its search focused; focus returns to `trigger` on close. */
|
|
4320
|
+
openSearch(trigger) {
|
|
4321
|
+
if (this.isDrawerOpen()) {
|
|
4322
|
+
this.#focusSearchField();
|
|
4323
|
+
return;
|
|
4324
|
+
}
|
|
4325
|
+
this.focusSearchOnOpen.set(true);
|
|
4326
|
+
this.openDrawer(trigger);
|
|
4327
|
+
}
|
|
4328
|
+
closeFromBackdrop() {
|
|
4329
|
+
this.#closeDrawer();
|
|
4330
|
+
}
|
|
4331
|
+
closeFromEscape() {
|
|
4332
|
+
this.#closeDrawer();
|
|
4333
|
+
}
|
|
4334
|
+
closeFromNavigation() {
|
|
4335
|
+
this.#closeDrawer();
|
|
4336
|
+
}
|
|
4337
|
+
onDrawerKeydown(event) {
|
|
4338
|
+
// why: Esc đã được lớp trong xử lý (xoá query, đóng popup tài khoản) hoặc đang huỷ gõ IME thì không đóng luôn drawer.
|
|
4339
|
+
if (event.key !== 'Escape' || event.defaultPrevented || event.isComposing)
|
|
4340
|
+
return;
|
|
4341
|
+
event.preventDefault();
|
|
4342
|
+
this.closeFromEscape();
|
|
4343
|
+
}
|
|
4344
|
+
navigateMenu(menu) {
|
|
4345
|
+
if (!('path' in menu))
|
|
4346
|
+
return;
|
|
4347
|
+
this.#navigationState.recordRecent(menu, this.recentConfiguration());
|
|
4348
|
+
// why: `includes('http')` là substring test — `javascript:fetch(...)//http` lọt qua và chạy như
|
|
4349
|
+
// script trong origin của app. Parse URL thật rồi mới mở, kèm `noopener,noreferrer`.
|
|
4350
|
+
if (sdIsExternalHttpUrl(menu.path)) {
|
|
4351
|
+
sdOpenExternal(menu.path);
|
|
4352
|
+
this.closeFromNavigation();
|
|
4353
|
+
return;
|
|
4354
|
+
}
|
|
4355
|
+
void this.#router
|
|
4356
|
+
.navigate([menu.path.split('?')[0]], { queryParams: menu.queryParams ?? {}, state: { switchTab: true } })
|
|
4357
|
+
.then(navigated => {
|
|
4358
|
+
if (navigated)
|
|
4359
|
+
this.closeFromNavigation();
|
|
4360
|
+
});
|
|
4361
|
+
}
|
|
4362
|
+
onTogglePinned(menu) {
|
|
4363
|
+
this.#navigationState.togglePinned(menu);
|
|
4364
|
+
}
|
|
4365
|
+
activateDestination(destination, trigger) {
|
|
4366
|
+
if (destination.disabled)
|
|
4367
|
+
return;
|
|
4368
|
+
if (!destination.isGroup) {
|
|
4369
|
+
this.navigateMenu(destination.menu);
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
// why: group không có route — mở drawer tại đúng group đó (và các group cha) như rail V4 với collapsedGroup 'expand'.
|
|
4373
|
+
const keys = new Set(destination.expandKeys);
|
|
4374
|
+
this.collapsedGroupKeys.update(current => current.filter(key => !keys.has(key)));
|
|
4375
|
+
this.openDrawer(trigger);
|
|
4376
|
+
}
|
|
4377
|
+
onSearchInput(event) {
|
|
4378
|
+
const value = event.target.value;
|
|
4379
|
+
this.searchText.set(value);
|
|
4380
|
+
this.#focusRequest.set(0);
|
|
4381
|
+
// why: kết quả bắt đầu ở đầu list và kết quả đầu được chọn sẵn — bỏ vị trí cuộn cũ của cây để nó luôn thấy được.
|
|
4382
|
+
const list = this.list()?.nativeElement;
|
|
4383
|
+
if (value.trim() && list)
|
|
4384
|
+
list.scrollTop = 0;
|
|
4385
|
+
}
|
|
4386
|
+
clearSearch() {
|
|
4387
|
+
this.#clearQuery();
|
|
4388
|
+
this.searchInput()?.nativeElement.focus();
|
|
4389
|
+
}
|
|
4390
|
+
onSearchKeydown(event) {
|
|
4391
|
+
if (event.isComposing)
|
|
4392
|
+
return;
|
|
4393
|
+
switch (event.key) {
|
|
4394
|
+
case 'ArrowDown':
|
|
4395
|
+
case 'ArrowUp': {
|
|
4396
|
+
const count = this.searchResults().length;
|
|
4397
|
+
if (!count)
|
|
4398
|
+
return;
|
|
4399
|
+
event.preventDefault();
|
|
4400
|
+
const next = Math.min(Math.max(this.focusedResultIndex() + (event.key === 'ArrowDown' ? 1 : -1), 0), count - 1);
|
|
4401
|
+
this.#focusRequest.set(next);
|
|
4402
|
+
this.#revealResult(next);
|
|
4403
|
+
return;
|
|
4404
|
+
}
|
|
4405
|
+
case 'Enter': {
|
|
4406
|
+
const result = this.searchResults()[this.focusedResultIndex()];
|
|
4407
|
+
if (!result)
|
|
4408
|
+
return;
|
|
4409
|
+
event.preventDefault();
|
|
4410
|
+
this.navigateMenu(result.menu);
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
case 'Escape':
|
|
4414
|
+
// why: Esc đầu xoá query như gợi ý "Esc clear" của kết quả; ô đã trống thì để Esc tới drawer và đóng nó.
|
|
4415
|
+
if (!this.searchText())
|
|
4416
|
+
return;
|
|
4417
|
+
event.preventDefault();
|
|
4418
|
+
this.#clearQuery();
|
|
4419
|
+
}
|
|
4420
|
+
}
|
|
4421
|
+
#revealResult(index) {
|
|
4422
|
+
const tree = this.mainTree();
|
|
4423
|
+
// why: listbox cuộn trong nav — option được chọn phải luôn nằm trong vùng thấy được (WCAG 2.4.11).
|
|
4424
|
+
if (tree)
|
|
4425
|
+
this.#document.getElementById(tree.resultOptionId(index))?.scrollIntoView({ block: 'nearest' });
|
|
4426
|
+
}
|
|
4427
|
+
#focusSearchField() {
|
|
4428
|
+
const field = this.searchInput()?.nativeElement;
|
|
4429
|
+
field?.focus();
|
|
4430
|
+
field?.select();
|
|
4431
|
+
}
|
|
4432
|
+
#clearQuery() {
|
|
4433
|
+
this.searchText.set('');
|
|
4434
|
+
this.#focusRequest.set(0);
|
|
4435
|
+
}
|
|
4436
|
+
#closeDrawer() {
|
|
4437
|
+
if (!this.isDrawerOpen())
|
|
4438
|
+
return;
|
|
4439
|
+
this.isDrawerOpen.set(false);
|
|
4440
|
+
this.focusSearchOnOpen.set(false);
|
|
4441
|
+
this.#clearQuery();
|
|
4442
|
+
this.#releaseBodyScroll();
|
|
4443
|
+
(this.#restoreFocusElement ?? this.trigger()?.nativeElement)?.focus();
|
|
4444
|
+
this.#restoreFocusElement = null;
|
|
4445
|
+
}
|
|
4446
|
+
#releaseBodyScroll() {
|
|
4447
|
+
this.#document.body.style.overflow = this.#previousBodyOverflow;
|
|
4448
|
+
}
|
|
4449
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileV4, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4450
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSidebarMobileV4, isStandalone: true, selector: "sd-sidebar-mobile-v4", inputs: { menus: { classPropertyName: "menus", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null }, userInfo: { classPropertyName: "userInfo", publicName: "userInfo", isSignal: true, isRequired: true, transformFunction: null }, sidebar: { classPropertyName: "sidebar", publicName: "sidebar", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.sd-sidebar-mobile-v4--soft": "configuration().itemShape === \"soft\"", "class.sd-sidebar-mobile-v4--bottom-bar": "destinations().length > 0" }, classAttribute: "sd-sidebar-mobile-v4" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "mainTree", first: true, predicate: ["mainTree"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _open = isDrawerOpen();\n@let _configuration = configuration();\n@let _destinations = destinations();\n@let _searchLabel = 'core.module.layout.sidebar.v4-search-placeholder' | sdTranslate;\n@let _navLabel = 'core.module.layout.sidebar.primary-nav' | sdTranslate;\n<header data-v4m-appbar class=\"sd-sidebar-mobile-v4__appbar\">\n <button\n #trigger\n type=\"button\"\n data-v4m-menu-trigger\n class=\"sd-sidebar-mobile-v4__icon-button sd-sidebar-mobile-v4__icon-button--appbar\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'core.module.layout.sidebar.open-menu' | sdTranslate\"\n [attr.aria-expanded]=\"_open\"\n (click)=\"openDrawer($event.currentTarget)\">\n <sd-icon name=\"menu\" size=\"24px\"></sd-icon>\n </button>\n <span data-v4m-appbar-title class=\"sd-sidebar-mobile-v4__appbar-title\">{{ title() }}</span>\n <button\n type=\"button\"\n data-v4m-search-trigger\n class=\"sd-sidebar-mobile-v4__icon-button sd-sidebar-mobile-v4__icon-button--appbar\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"_searchLabel\"\n (click)=\"openSearch($event.currentTarget)\">\n <sd-icon name=\"search\" size=\"22px\"></sd-icon>\n </button>\n @let _displayName = displayName();\n <span\n data-v4m-avatar\n class=\"sd-sidebar-mobile-v4__avatar\"\n [attr.role]=\"_displayName ? 'img' : null\"\n [attr.aria-label]=\"_displayName || null\"\n [attr.aria-hidden]=\"_displayName ? null : 'true'\"\n >{{ userInitials() }}</span\n >\n</header>\n\n<main data-v4m-content class=\"sd-sidebar-mobile-v4__content\">\n <ng-content></ng-content>\n</main>\n\n@if (_destinations.length) {\n <nav data-v4m-bottom-bar class=\"sd-sidebar-mobile-v4__bottom-bar\" [attr.aria-label]=\"_navLabel\">\n @for (item of _destinations; track item.key) {\n <button\n #destinationButton\n type=\"button\"\n class=\"sd-sidebar-mobile-v4__destination\"\n [class.sd-sidebar-mobile-v4__destination--active]=\"item.isActive\"\n [class.sd-sidebar-mobile-v4__destination--disabled]=\"item.disabled\"\n [attr.data-v4m-destination]=\"item.key\"\n [attr.aria-current]=\"item.isActive ? (item.isGroup ? 'true' : 'page') : null\"\n [attr.aria-disabled]=\"item.disabled || null\"\n [attr.aria-haspopup]=\"item.isGroup && !item.disabled ? 'dialog' : null\"\n [attr.aria-describedby]=\"item.badge || item.liveTone ? item.descriptionId : null\"\n (click)=\"activateDestination(item, destinationButton)\">\n <span data-v4m-indicator class=\"sd-sidebar-mobile-v4__indicator\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-mobile-v4__destination-image\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon\n [name]=\"item.menu.icon || (item.isGroup ? 'folder' : 'chevron_right')\"\n [fontSet]=\"item.isActive ? 'material-icons' : 'material-icons-outlined'\"\n size=\"22px\"></sd-icon>\n }\n @if (item.badge) {\n <span\n data-v4m-badge\n class=\"sd-sidebar-mobile-v4__badge\"\n [class.sd-sidebar-mobile-v4__badge--error]=\"item.badge.tone === 'error'\"\n aria-hidden=\"true\">\n {{ item.badge.value }}\n </span>\n } @else if (item.liveTone) {\n <span data-v4m-live class=\"sd-sidebar-mobile-v4__live\" [attr.data-tone]=\"item.liveTone\" aria-hidden=\"true\"></span>\n }\n </span>\n <span data-v4m-label class=\"sd-sidebar-mobile-v4__label\">{{ item.label }}</span>\n @if (item.badge) {\n <span hidden [id]=\"item.descriptionId\">{{\n 'core.module.layout.sidebar.badge-pending' | sdTranslate: { count: item.badge.value }\n }}</span>\n } @else if (item.liveTone) {\n <span hidden [id]=\"item.descriptionId\">{{ item.liveLabel }}</span>\n }\n </button>\n }\n <button\n type=\"button\"\n data-v4m-more\n class=\"sd-sidebar-mobile-v4__destination\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n (click)=\"openDrawer($event.currentTarget)\">\n <span data-v4m-indicator class=\"sd-sidebar-mobile-v4__indicator\">\n <sd-icon name=\"menu\" size=\"22px\"></sd-icon>\n </span>\n <span data-v4m-label class=\"sd-sidebar-mobile-v4__label\">{{ 'core.module.layout.sidebar.more' | sdTranslate }}</span>\n </button>\n </nav>\n}\n\n@if (_open) {\n @let _query = searchText();\n @let _hasQuery = hasQuery();\n @let _focused = focusedResultIndex();\n @let _hasResults = _focused >= 0;\n @let _pinned = pinnedMenus();\n @let _recent = recentMenus();\n @let _showPinned = !_hasQuery && _pinned.length > 0;\n @let _showRecent = !_hasQuery && recentConfiguration().enabled && _recent.length > 0;\n <button\n type=\"button\"\n data-v4m-backdrop\n class=\"sd-sidebar-mobile-v4__backdrop\"\n [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\"\n (click)=\"closeFromBackdrop()\"></button>\n <aside\n data-v4m-drawer\n class=\"sd-sidebar-mobile-v4__drawer\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"titleId\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onDrawerKeydown($event)\">\n <header data-v4m-header class=\"sd-sidebar-mobile-v4__header\">\n <span class=\"sd-sidebar-mobile-v4__logo\" [class.sd-sidebar-mobile-v4__logo--image]=\"!!_configuration.logoUrl\" aria-hidden=\"true\">\n @if (_configuration.logoUrl) {\n <img [src]=\"_configuration.logoUrl\" alt=\"\" />\n } @else {\n {{ logoInitial() }}\n }\n </span>\n <div class=\"sd-sidebar-mobile-v4__brand\">\n <span data-v4m-drawer-title class=\"sd-sidebar-mobile-v4__title\" [id]=\"titleId\">{{ title() }}</span>\n @if (_configuration.context) {\n <sd-layout-context-switcher appearance=\"sheet\" [configuration]=\"_configuration.context\" />\n }\n </div>\n <button\n type=\"button\"\n data-v4m-close\n class=\"sd-sidebar-mobile-v4__icon-button\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"closeFromBackdrop()\">\n <sd-icon name=\"close\" size=\"22px\"></sd-icon>\n </button>\n </header>\n\n <div data-v4m-search class=\"sd-sidebar-mobile-v4__search\">\n <div data-v4m-search-field class=\"sd-sidebar-mobile-v4__search-field\" [class.sd-sidebar-mobile-v4__search-field--filled]=\"!!_query\">\n <sd-icon class=\"sd-sidebar-mobile-v4__search-icon\" name=\"search\" size=\"20px\" aria-hidden=\"true\"></sd-icon>\n <input\n #searchInput\n data-v4m-search-input\n class=\"sd-sidebar-mobile-v4__search-input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n [attr.cdkFocusInitial]=\"focusSearchOnOpen() ? '' : null\"\n [attr.aria-label]=\"_searchLabel\"\n [attr.placeholder]=\"_searchLabel\"\n [attr.aria-expanded]=\"_hasResults\"\n [attr.aria-controls]=\"_hasResults ? mainTree.resultsId : null\"\n [attr.aria-activedescendant]=\"_hasResults ? mainTree.resultOptionId(_focused) : null\"\n [value]=\"_query\"\n (input)=\"onSearchInput($event)\"\n (keydown)=\"onSearchKeydown($event)\" />\n @if (_query) {\n <button\n type=\"button\"\n data-v4m-search-clear\n class=\"sd-sidebar-mobile-v4__search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\"></sd-icon>\n </button>\n }\n </div>\n </div>\n\n <nav #list data-v4m-nav class=\"sd-sidebar-mobile-v4__list\" [attr.aria-label]=\"'core.module.layout.sidebar.all-menu' | sdTranslate\">\n @if (_showPinned) {\n <section data-v4m-pinned class=\"sd-sidebar-mobile-v4__shortcuts\">\n <h2 class=\"sd-sidebar-mobile-v4__section-label\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n mode=\"mobile\"\n [menus]=\"_pinned\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\" />\n </section>\n }\n @if (_showRecent) {\n <section data-v4m-recent class=\"sd-sidebar-mobile-v4__shortcuts\">\n <h2 class=\"sd-sidebar-mobile-v4__section-label\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n mode=\"mobile\"\n [menus]=\"_recent\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\" />\n </section>\n }\n <!-- One tree instance for hierarchy and results: its live region must stay mounted to announce result counts. -->\n <sd-sidebar-v4-menu-tree\n #mainTree\n data-v4m-tree\n mode=\"mobile\"\n [class.sd-sidebar-mobile-v4__tree--separated]=\"(_showPinned || _showRecent) && leadsWithUnsectioned()\"\n [menus]=\"menus()\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [presentation]=\"_hasQuery ? 'results' : 'hierarchy'\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [pinnedKeys]=\"pinnedKeys()\"\n [query]=\"_query\"\n [focusedIndex]=\"_focused\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\" />\n </nav>\n\n <div data-v4m-footer class=\"sd-sidebar-mobile-v4__footer\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n </div>\n </aside>\n}\n", styles: [":host{--sd-sidebar-v4-item-height: 44px;--sd-sidebar-v4-child-height: 44px;--sd-sidebar-v4-item-radius: 999px;--sidebar-drawer-width: min(88vw, 360px);--sidebar-bottom-bar-height: 64px;--sidebar-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--sidebar-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--sidebar-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--sidebar-muted-ink: var(--sd-text-secondary);--sidebar-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));display:block;min-height:100dvh;background:var(--sd-light);color:var(--sd-text)}:host(.sd-sidebar-mobile-v4--soft){--sd-sidebar-v4-item-radius: 8px}.sd-sidebar-mobile-v4__icon-button,.sd-sidebar-mobile-v4__search-clear{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;margin:0;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sidebar-muted-ink);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-mobile-v4__icon-button:focus-visible,.sd-sidebar-mobile-v4__search-clear:focus-visible{outline:none;box-shadow:var(--sidebar-focus-ring)}@media(hover:hover){.sd-sidebar-mobile-v4__icon-button:hover,.sd-sidebar-mobile-v4__search-clear:hover{background:var(--sidebar-hover-bg)}}.sd-sidebar-mobile-v4__icon-button{width:44px;height:44px}.sd-sidebar-mobile-v4__icon-button--appbar{color:var(--sd-text)}.sd-sidebar-mobile-v4__appbar{display:flex;align-items:center;gap:var(--sd-space-4, 4px);box-sizing:border-box;height:56px;padding:0 8px 0 4px;border-bottom:1px solid var(--sidebar-line);background:var(--sd-surface)}.sd-sidebar-mobile-v4__appbar-title{flex:1 1 auto;min-width:0;overflow:hidden;font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-24, 24px);text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-mobile-v4__avatar{display:inline-flex;flex:none;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-sidebar-v4-avatar-bg, color-mix(in srgb, var(--sd-primary) 14%, var(--sd-surface)));color:var(--sd-sidebar-v4-avatar-ink, var(--sd-primary));font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);line-height:1}:host(.sd-sidebar-mobile-v4--bottom-bar) .sd-sidebar-mobile-v4__content{padding-bottom:calc(var(--sidebar-bottom-bar-height) + 1px + env(safe-area-inset-bottom))}.sd-sidebar-mobile-v4__bottom-bar{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:auto 0 0;display:grid;grid-auto-columns:minmax(0,1fr);grid-auto-flow:column;padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--sidebar-line);background:var(--sd-surface)}.sd-sidebar-mobile-v4__destination{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;box-sizing:border-box;min-width:0;height:var(--sidebar-bottom-bar-height);margin:0;padding:0 2px;border:0;background:transparent;color:var(--sidebar-muted-ink);font:inherit;cursor:pointer}.sd-sidebar-mobile-v4__destination:focus-visible{outline:none}.sd-sidebar-mobile-v4__destination:focus-visible .sd-sidebar-mobile-v4__indicator{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-mobile-v4__indicator{position:relative;display:flex;flex:none;align-items:center;justify-content:center;width:56px;height:30px;border-radius:var(--sd-radius-999, 999px);transition:background-color var(--sd-duration-fast, .12s) ease}@media(hover:hover){.sd-sidebar-mobile-v4__destination:hover .sd-sidebar-mobile-v4__indicator{background:var(--sidebar-hover-bg)}.sd-sidebar-mobile-v4__destination--disabled:hover .sd-sidebar-mobile-v4__indicator{background:transparent}}.sd-sidebar-mobile-v4__destination--active .sd-sidebar-mobile-v4__indicator,.sd-sidebar-mobile-v4__destination--active:hover .sd-sidebar-mobile-v4__indicator{background:var(--sd-primary-light);color:var(--sd-primary)}.sd-sidebar-mobile-v4__destination--active:focus-visible .sd-sidebar-mobile-v4__indicator{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-mobile-v4__destination--disabled{color:var(--sd-disabled-text, color-mix(in srgb, var(--sd-text) 60%, transparent));cursor:not-allowed}.sd-sidebar-mobile-v4__destination-image{width:22px;height:22px;object-fit:contain}.sd-sidebar-mobile-v4__destination--disabled .sd-sidebar-mobile-v4__destination-image{opacity:.6}.sd-sidebar-mobile-v4__label{max-width:100%;overflow:hidden;color:var(--sd-text-secondary);font-size:11.5px;font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-16, 16px);text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-mobile-v4__destination--active .sd-sidebar-mobile-v4__label{color:var(--sd-text);font-weight:var(--sd-font-weight-medium, 500)}.sd-sidebar-mobile-v4__destination--disabled .sd-sidebar-mobile-v4__label{color:inherit}.sd-sidebar-mobile-v4__badge{position:absolute;top:-2px;right:8px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:16px;height:16px;padding:0 4px;border-radius:var(--sd-radius-8, 8px);background:var(--sd-sidebar-v4-attention, var(--sd-warning));box-shadow:0 0 0 2px var(--sd-surface);color:var(--sd-warning-contrast);font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;pointer-events:none}.sd-sidebar-mobile-v4__badge--error{background:var(--sd-error);color:var(--sd-error-contrast)}.sd-sidebar-mobile-v4__live{--live-tone: var(--sd-sidebar-v4-live, var(--sd-success));position:absolute;top:2px;right:14px;width:8px;height:8px;border-radius:var(--sd-radius-4, 4px);background:var(--live-tone);box-shadow:0 0 0 2px var(--sd-surface);pointer-events:none}.sd-sidebar-mobile-v4__live[data-tone=warning]{--live-tone: var(--sd-warning)}.sd-sidebar-mobile-v4__live[data-tone=error]{--live-tone: var(--sd-error)}.sd-sidebar-mobile-v4__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;margin:0;padding:0;border:0;background:var(--sd-overlay-backdrop, color-mix(in srgb, var(--sd-text) 40%, transparent))}.sd-sidebar-mobile-v4__drawer{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:0 auto 0 0;display:flex;flex-direction:column;box-sizing:border-box;width:var(--sidebar-drawer-width);max-width:100%;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);border-radius:0 var(--sd-radius-24, 24px) var(--sd-radius-24, 24px) 0;background:var(--sidebar-bg);box-shadow:0 8px 32px color-mix(in srgb,var(--sd-text) 18%,transparent);color:var(--sd-text)}.sd-sidebar-mobile-v4__drawer:focus{outline:none}.sd-sidebar-mobile-v4__header{display:flex;flex:none;align-items:center;gap:var(--sd-space-12, 12px);box-sizing:border-box;min-height:64px;padding:0 12px 0 16px}.sd-sidebar-mobile-v4__logo{display:inline-flex;flex:none;align-items:center;justify-content:center;overflow:hidden;width:28px;height:28px;border-radius:var(--sd-radius-8, 8px);background:var(--sd-primary);color:var(--sd-primary-contrast);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-bold, 700);line-height:1}.sd-sidebar-mobile-v4__logo img{width:100%;height:100%;object-fit:contain}.sd-sidebar-mobile-v4__logo--image{background:transparent}.sd-sidebar-mobile-v4__brand{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.sd-sidebar-mobile-v4__title{overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-mobile-v4__search{flex:none;padding:0 12px 6px}.sd-sidebar-mobile-v4__search-field{display:flex;align-items:center;gap:var(--sd-space-8, 8px);box-sizing:border-box;height:44px;padding:0 12px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-border) 50%,var(--sd-surface));color:var(--sidebar-muted-ink)}.sd-sidebar-mobile-v4__search-field:focus-within{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-mobile-v4__search-field--filled,.sd-sidebar-mobile-v4__search-field--filled:focus-within{padding-right:0;box-shadow:inset 0 0 0 2px var(--sd-primary)}.sd-sidebar-mobile-v4__search-icon{flex:none}.sd-sidebar-mobile-v4__search-input{flex:1 1 auto;min-width:0;height:100%;margin:0;padding:0;border:0;outline:0;background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px)}.sd-sidebar-mobile-v4__search-input::placeholder{color:var(--sidebar-muted-ink);opacity:1}.sd-sidebar-mobile-v4__search-clear{width:44px;height:44px}.sd-sidebar-mobile-v4__list{flex:1 1 auto;min-height:0;box-sizing:border-box;padding:0 12px 12px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}.sd-sidebar-mobile-v4__section-label{margin:0;padding:14px 12px 4px;color:var(--sidebar-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-sidebar-mobile-v4__tree--separated{margin-top:var(--sd-space-16, 16px)}.sd-sidebar-mobile-v4__footer{flex:none;box-sizing:border-box;padding:12px 8px 12px 16px;border-top:1px solid var(--sidebar-line)}.sd-sidebar-mobile-v4__footer ::ng-deep .sd-layout-user-menu__popup{box-sizing:border-box;left:-4px;width:calc(var(--sidebar-drawer-width) - 24px)}@media(pointer:coarse){.sd-sidebar-mobile-v4__search-input{font-size:var(--sd-font-size-16, 16px)}}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v4__icon-button,.sd-sidebar-mobile-v4__search-clear,.sd-sidebar-mobile-v4__indicator{transition:none}}\n"], dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdLayoutContextSwitcher, selector: "sd-layout-context-switcher", inputs: ["configuration", "appearance", "placement", "anchor"] }, { kind: "component", type: SdLayoutUserMenuComponent, selector: "sd-layout-user-menu", inputs: ["userInfo", "signout", "changePassword", "updateProfile", "setting", "notification", "compact", "presentation"], outputs: ["opened", "closed"] }, { kind: "component", type: SdSidebarV4MenuTree, selector: "sd-sidebar-v4-menu-tree", inputs: ["menus", "pathSource", "activePath", "presentation", "mode", "collapsedGroupKeys", "pinnedKeys", "showPin", "collapsedGroup", "query", "focusedIndex"], outputs: ["collapsedGroupKeysChange", "navigate", "togglePinned", "expandGroup"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4451
|
+
}
|
|
4452
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSidebarMobileV4, decorators: [{
|
|
4453
|
+
type: Component,
|
|
4454
|
+
args: [{ selector: 'sd-sidebar-mobile-v4', standalone: true, imports: [CdkTrapFocus, SdIcon, SdLayoutContextSwitcher, SdLayoutUserMenuComponent, SdSidebarV4MenuTree, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
4455
|
+
class: 'sd-sidebar-mobile-v4',
|
|
4456
|
+
'[class.sd-sidebar-mobile-v4--soft]': 'configuration().itemShape === "soft"',
|
|
4457
|
+
'[class.sd-sidebar-mobile-v4--bottom-bar]': 'destinations().length > 0',
|
|
4458
|
+
}, template: "@let _open = isDrawerOpen();\n@let _configuration = configuration();\n@let _destinations = destinations();\n@let _searchLabel = 'core.module.layout.sidebar.v4-search-placeholder' | sdTranslate;\n@let _navLabel = 'core.module.layout.sidebar.primary-nav' | sdTranslate;\n<header data-v4m-appbar class=\"sd-sidebar-mobile-v4__appbar\">\n <button\n #trigger\n type=\"button\"\n data-v4m-menu-trigger\n class=\"sd-sidebar-mobile-v4__icon-button sd-sidebar-mobile-v4__icon-button--appbar\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"'core.module.layout.sidebar.open-menu' | sdTranslate\"\n [attr.aria-expanded]=\"_open\"\n (click)=\"openDrawer($event.currentTarget)\">\n <sd-icon name=\"menu\" size=\"24px\"></sd-icon>\n </button>\n <span data-v4m-appbar-title class=\"sd-sidebar-mobile-v4__appbar-title\">{{ title() }}</span>\n <button\n type=\"button\"\n data-v4m-search-trigger\n class=\"sd-sidebar-mobile-v4__icon-button sd-sidebar-mobile-v4__icon-button--appbar\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"_searchLabel\"\n (click)=\"openSearch($event.currentTarget)\">\n <sd-icon name=\"search\" size=\"22px\"></sd-icon>\n </button>\n @let _displayName = displayName();\n <span\n data-v4m-avatar\n class=\"sd-sidebar-mobile-v4__avatar\"\n [attr.role]=\"_displayName ? 'img' : null\"\n [attr.aria-label]=\"_displayName || null\"\n [attr.aria-hidden]=\"_displayName ? null : 'true'\"\n >{{ userInitials() }}</span\n >\n</header>\n\n<main data-v4m-content class=\"sd-sidebar-mobile-v4__content\">\n <ng-content></ng-content>\n</main>\n\n@if (_destinations.length) {\n <nav data-v4m-bottom-bar class=\"sd-sidebar-mobile-v4__bottom-bar\" [attr.aria-label]=\"_navLabel\">\n @for (item of _destinations; track item.key) {\n <button\n #destinationButton\n type=\"button\"\n class=\"sd-sidebar-mobile-v4__destination\"\n [class.sd-sidebar-mobile-v4__destination--active]=\"item.isActive\"\n [class.sd-sidebar-mobile-v4__destination--disabled]=\"item.disabled\"\n [attr.data-v4m-destination]=\"item.key\"\n [attr.aria-current]=\"item.isActive ? (item.isGroup ? 'true' : 'page') : null\"\n [attr.aria-disabled]=\"item.disabled || null\"\n [attr.aria-haspopup]=\"item.isGroup && !item.disabled ? 'dialog' : null\"\n [attr.aria-describedby]=\"item.badge || item.liveTone ? item.descriptionId : null\"\n (click)=\"activateDestination(item, destinationButton)\">\n <span data-v4m-indicator class=\"sd-sidebar-mobile-v4__indicator\">\n @if (item.menu.iconUrl) {\n <img class=\"sd-sidebar-mobile-v4__destination-image\" [src]=\"item.menu.iconUrl\" alt=\"\" />\n } @else {\n <sd-icon\n [name]=\"item.menu.icon || (item.isGroup ? 'folder' : 'chevron_right')\"\n [fontSet]=\"item.isActive ? 'material-icons' : 'material-icons-outlined'\"\n size=\"22px\"></sd-icon>\n }\n @if (item.badge) {\n <span\n data-v4m-badge\n class=\"sd-sidebar-mobile-v4__badge\"\n [class.sd-sidebar-mobile-v4__badge--error]=\"item.badge.tone === 'error'\"\n aria-hidden=\"true\">\n {{ item.badge.value }}\n </span>\n } @else if (item.liveTone) {\n <span data-v4m-live class=\"sd-sidebar-mobile-v4__live\" [attr.data-tone]=\"item.liveTone\" aria-hidden=\"true\"></span>\n }\n </span>\n <span data-v4m-label class=\"sd-sidebar-mobile-v4__label\">{{ item.label }}</span>\n @if (item.badge) {\n <span hidden [id]=\"item.descriptionId\">{{\n 'core.module.layout.sidebar.badge-pending' | sdTranslate: { count: item.badge.value }\n }}</span>\n } @else if (item.liveTone) {\n <span hidden [id]=\"item.descriptionId\">{{ item.liveLabel }}</span>\n }\n </button>\n }\n <button\n type=\"button\"\n data-v4m-more\n class=\"sd-sidebar-mobile-v4__destination\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"_open\"\n (click)=\"openDrawer($event.currentTarget)\">\n <span data-v4m-indicator class=\"sd-sidebar-mobile-v4__indicator\">\n <sd-icon name=\"menu\" size=\"22px\"></sd-icon>\n </span>\n <span data-v4m-label class=\"sd-sidebar-mobile-v4__label\">{{ 'core.module.layout.sidebar.more' | sdTranslate }}</span>\n </button>\n </nav>\n}\n\n@if (_open) {\n @let _query = searchText();\n @let _hasQuery = hasQuery();\n @let _focused = focusedResultIndex();\n @let _hasResults = _focused >= 0;\n @let _pinned = pinnedMenus();\n @let _recent = recentMenus();\n @let _showPinned = !_hasQuery && _pinned.length > 0;\n @let _showRecent = !_hasQuery && recentConfiguration().enabled && _recent.length > 0;\n <button\n type=\"button\"\n data-v4m-backdrop\n class=\"sd-sidebar-mobile-v4__backdrop\"\n [attr.aria-label]=\"'core.module.layout.sidebar.close-menu' | sdTranslate\"\n (click)=\"closeFromBackdrop()\"></button>\n <aside\n data-v4m-drawer\n class=\"sd-sidebar-mobile-v4__drawer\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"titleId\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown)=\"onDrawerKeydown($event)\">\n <header data-v4m-header class=\"sd-sidebar-mobile-v4__header\">\n <span class=\"sd-sidebar-mobile-v4__logo\" [class.sd-sidebar-mobile-v4__logo--image]=\"!!_configuration.logoUrl\" aria-hidden=\"true\">\n @if (_configuration.logoUrl) {\n <img [src]=\"_configuration.logoUrl\" alt=\"\" />\n } @else {\n {{ logoInitial() }}\n }\n </span>\n <div class=\"sd-sidebar-mobile-v4__brand\">\n <span data-v4m-drawer-title class=\"sd-sidebar-mobile-v4__title\" [id]=\"titleId\">{{ title() }}</span>\n @if (_configuration.context) {\n <sd-layout-context-switcher appearance=\"sheet\" [configuration]=\"_configuration.context\" />\n }\n </div>\n <button\n type=\"button\"\n data-v4m-close\n class=\"sd-sidebar-mobile-v4__icon-button\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\"\n (click)=\"closeFromBackdrop()\">\n <sd-icon name=\"close\" size=\"22px\"></sd-icon>\n </button>\n </header>\n\n <div data-v4m-search class=\"sd-sidebar-mobile-v4__search\">\n <div data-v4m-search-field class=\"sd-sidebar-mobile-v4__search-field\" [class.sd-sidebar-mobile-v4__search-field--filled]=\"!!_query\">\n <sd-icon class=\"sd-sidebar-mobile-v4__search-icon\" name=\"search\" size=\"20px\" aria-hidden=\"true\"></sd-icon>\n <input\n #searchInput\n data-v4m-search-input\n class=\"sd-sidebar-mobile-v4__search-input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n aria-autocomplete=\"list\"\n [attr.cdkFocusInitial]=\"focusSearchOnOpen() ? '' : null\"\n [attr.aria-label]=\"_searchLabel\"\n [attr.placeholder]=\"_searchLabel\"\n [attr.aria-expanded]=\"_hasResults\"\n [attr.aria-controls]=\"_hasResults ? mainTree.resultsId : null\"\n [attr.aria-activedescendant]=\"_hasResults ? mainTree.resultOptionId(_focused) : null\"\n [value]=\"_query\"\n (input)=\"onSearchInput($event)\"\n (keydown)=\"onSearchKeydown($event)\" />\n @if (_query) {\n <button\n type=\"button\"\n data-v4m-search-clear\n class=\"sd-sidebar-mobile-v4__search-clear\"\n [attr.aria-label]=\"'core.module.layout.sidebar.clear-search' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\"></sd-icon>\n </button>\n }\n </div>\n </div>\n\n <nav #list data-v4m-nav class=\"sd-sidebar-mobile-v4__list\" [attr.aria-label]=\"'core.module.layout.sidebar.all-menu' | sdTranslate\">\n @if (_showPinned) {\n <section data-v4m-pinned class=\"sd-sidebar-mobile-v4__shortcuts\">\n <h2 class=\"sd-sidebar-mobile-v4__section-label\">{{ 'core.module.layout.sidebar.pinned' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n mode=\"mobile\"\n [menus]=\"_pinned\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [pinnedKeys]=\"pinnedKeys()\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\" />\n </section>\n }\n @if (_showRecent) {\n <section data-v4m-recent class=\"sd-sidebar-mobile-v4__shortcuts\">\n <h2 class=\"sd-sidebar-mobile-v4__section-label\">{{ 'core.module.layout.sidebar.recent' | sdTranslate }}</h2>\n <sd-sidebar-v4-menu-tree\n presentation=\"shortcuts\"\n mode=\"mobile\"\n [menus]=\"_recent\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [showPin]=\"false\"\n (navigate)=\"navigateMenu($event)\" />\n </section>\n }\n <!-- One tree instance for hierarchy and results: its live region must stay mounted to announce result counts. -->\n <sd-sidebar-v4-menu-tree\n #mainTree\n data-v4m-tree\n mode=\"mobile\"\n [class.sd-sidebar-mobile-v4__tree--separated]=\"(_showPinned || _showRecent) && leadsWithUnsectioned()\"\n [menus]=\"menus()\"\n [pathSource]=\"menus()\"\n [activePath]=\"activePath()\"\n [presentation]=\"_hasQuery ? 'results' : 'hierarchy'\"\n [(collapsedGroupKeys)]=\"collapsedGroupKeys\"\n [pinnedKeys]=\"pinnedKeys()\"\n [query]=\"_query\"\n [focusedIndex]=\"_focused\"\n (navigate)=\"navigateMenu($event)\"\n (togglePinned)=\"onTogglePinned($event)\" />\n </nav>\n\n <div data-v4m-footer class=\"sd-sidebar-mobile-v4__footer\">\n <sd-layout-user-menu [userInfo]=\"userInfo()\"></sd-layout-user-menu>\n </div>\n </aside>\n}\n", styles: [":host{--sd-sidebar-v4-item-height: 44px;--sd-sidebar-v4-child-height: 44px;--sd-sidebar-v4-item-radius: 999px;--sidebar-drawer-width: min(88vw, 360px);--sidebar-bottom-bar-height: 64px;--sidebar-bg: var(--sd-sidebar-v4-bg, color-mix(in srgb, var(--sd-text) 4%, var(--sd-surface)));--sidebar-line: var(--sd-sidebar-v4-line, color-mix(in srgb, var(--sd-border) 45%, var(--sd-surface)));--sidebar-hover-bg: var(--sd-sidebar-v4-hover-bg, color-mix(in srgb, var(--sd-text) 6%, transparent));--sidebar-muted-ink: var(--sd-text-secondary);--sidebar-focus-ring: inset 0 0 0 2px var(--sd-focus-ring-color, var(--sd-primary));display:block;min-height:100dvh;background:var(--sd-light);color:var(--sd-text)}:host(.sd-sidebar-mobile-v4--soft){--sd-sidebar-v4-item-radius: 8px}.sd-sidebar-mobile-v4__icon-button,.sd-sidebar-mobile-v4__search-clear{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;margin:0;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sidebar-muted-ink);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease}.sd-sidebar-mobile-v4__icon-button:focus-visible,.sd-sidebar-mobile-v4__search-clear:focus-visible{outline:none;box-shadow:var(--sidebar-focus-ring)}@media(hover:hover){.sd-sidebar-mobile-v4__icon-button:hover,.sd-sidebar-mobile-v4__search-clear:hover{background:var(--sidebar-hover-bg)}}.sd-sidebar-mobile-v4__icon-button{width:44px;height:44px}.sd-sidebar-mobile-v4__icon-button--appbar{color:var(--sd-text)}.sd-sidebar-mobile-v4__appbar{display:flex;align-items:center;gap:var(--sd-space-4, 4px);box-sizing:border-box;height:56px;padding:0 8px 0 4px;border-bottom:1px solid var(--sidebar-line);background:var(--sd-surface)}.sd-sidebar-mobile-v4__appbar-title{flex:1 1 auto;min-width:0;overflow:hidden;font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-24, 24px);text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-mobile-v4__avatar{display:inline-flex;flex:none;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-sidebar-v4-avatar-bg, color-mix(in srgb, var(--sd-primary) 14%, var(--sd-surface)));color:var(--sd-sidebar-v4-avatar-ink, var(--sd-primary));font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-medium, 500);line-height:1}:host(.sd-sidebar-mobile-v4--bottom-bar) .sd-sidebar-mobile-v4__content{padding-bottom:calc(var(--sidebar-bottom-bar-height) + 1px + env(safe-area-inset-bottom))}.sd-sidebar-mobile-v4__bottom-bar{position:fixed;z-index:var(--sd-z-sidebar, 20);inset:auto 0 0;display:grid;grid-auto-columns:minmax(0,1fr);grid-auto-flow:column;padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--sidebar-line);background:var(--sd-surface)}.sd-sidebar-mobile-v4__destination{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;box-sizing:border-box;min-width:0;height:var(--sidebar-bottom-bar-height);margin:0;padding:0 2px;border:0;background:transparent;color:var(--sidebar-muted-ink);font:inherit;cursor:pointer}.sd-sidebar-mobile-v4__destination:focus-visible{outline:none}.sd-sidebar-mobile-v4__destination:focus-visible .sd-sidebar-mobile-v4__indicator{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-mobile-v4__indicator{position:relative;display:flex;flex:none;align-items:center;justify-content:center;width:56px;height:30px;border-radius:var(--sd-radius-999, 999px);transition:background-color var(--sd-duration-fast, .12s) ease}@media(hover:hover){.sd-sidebar-mobile-v4__destination:hover .sd-sidebar-mobile-v4__indicator{background:var(--sidebar-hover-bg)}.sd-sidebar-mobile-v4__destination--disabled:hover .sd-sidebar-mobile-v4__indicator{background:transparent}}.sd-sidebar-mobile-v4__destination--active .sd-sidebar-mobile-v4__indicator,.sd-sidebar-mobile-v4__destination--active:hover .sd-sidebar-mobile-v4__indicator{background:var(--sd-primary-light);color:var(--sd-primary)}.sd-sidebar-mobile-v4__destination--active:focus-visible .sd-sidebar-mobile-v4__indicator{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-mobile-v4__destination--disabled{color:var(--sd-disabled-text, color-mix(in srgb, var(--sd-text) 60%, transparent));cursor:not-allowed}.sd-sidebar-mobile-v4__destination-image{width:22px;height:22px;object-fit:contain}.sd-sidebar-mobile-v4__destination--disabled .sd-sidebar-mobile-v4__destination-image{opacity:.6}.sd-sidebar-mobile-v4__label{max-width:100%;overflow:hidden;color:var(--sd-text-secondary);font-size:11.5px;font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-16, 16px);text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-mobile-v4__destination--active .sd-sidebar-mobile-v4__label{color:var(--sd-text);font-weight:var(--sd-font-weight-medium, 500)}.sd-sidebar-mobile-v4__destination--disabled .sd-sidebar-mobile-v4__label{color:inherit}.sd-sidebar-mobile-v4__badge{position:absolute;top:-2px;right:8px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:16px;height:16px;padding:0 4px;border-radius:var(--sd-radius-8, 8px);background:var(--sd-sidebar-v4-attention, var(--sd-warning));box-shadow:0 0 0 2px var(--sd-surface);color:var(--sd-warning-contrast);font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;pointer-events:none}.sd-sidebar-mobile-v4__badge--error{background:var(--sd-error);color:var(--sd-error-contrast)}.sd-sidebar-mobile-v4__live{--live-tone: var(--sd-sidebar-v4-live, var(--sd-success));position:absolute;top:2px;right:14px;width:8px;height:8px;border-radius:var(--sd-radius-4, 4px);background:var(--live-tone);box-shadow:0 0 0 2px var(--sd-surface);pointer-events:none}.sd-sidebar-mobile-v4__live[data-tone=warning]{--live-tone: var(--sd-warning)}.sd-sidebar-mobile-v4__live[data-tone=error]{--live-tone: var(--sd-error)}.sd-sidebar-mobile-v4__backdrop{position:fixed;z-index:var(--sd-z-popover, 40);inset:0;margin:0;padding:0;border:0;background:var(--sd-overlay-backdrop, color-mix(in srgb, var(--sd-text) 40%, transparent))}.sd-sidebar-mobile-v4__drawer{position:fixed;z-index:var(--sd-z-drawer-mobile, 50);inset:0 auto 0 0;display:flex;flex-direction:column;box-sizing:border-box;width:var(--sidebar-drawer-width);max-width:100%;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);border-radius:0 var(--sd-radius-24, 24px) var(--sd-radius-24, 24px) 0;background:var(--sidebar-bg);box-shadow:0 8px 32px color-mix(in srgb,var(--sd-text) 18%,transparent);color:var(--sd-text)}.sd-sidebar-mobile-v4__drawer:focus{outline:none}.sd-sidebar-mobile-v4__header{display:flex;flex:none;align-items:center;gap:var(--sd-space-12, 12px);box-sizing:border-box;min-height:64px;padding:0 12px 0 16px}.sd-sidebar-mobile-v4__logo{display:inline-flex;flex:none;align-items:center;justify-content:center;overflow:hidden;width:28px;height:28px;border-radius:var(--sd-radius-8, 8px);background:var(--sd-primary);color:var(--sd-primary-contrast);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-bold, 700);line-height:1}.sd-sidebar-mobile-v4__logo img{width:100%;height:100%;object-fit:contain}.sd-sidebar-mobile-v4__logo--image{background:transparent}.sd-sidebar-mobile-v4__brand{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.sd-sidebar-mobile-v4__title{overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-22, 22px);letter-spacing:-.2px;text-overflow:ellipsis;white-space:nowrap}.sd-sidebar-mobile-v4__search{flex:none;padding:0 12px 6px}.sd-sidebar-mobile-v4__search-field{display:flex;align-items:center;gap:var(--sd-space-8, 8px);box-sizing:border-box;height:44px;padding:0 12px;border-radius:var(--sd-radius-999, 999px);background:var(--sd-surface);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sd-border) 50%,var(--sd-surface));color:var(--sidebar-muted-ink)}.sd-sidebar-mobile-v4__search-field:focus-within{box-shadow:var(--sidebar-focus-ring)}.sd-sidebar-mobile-v4__search-field--filled,.sd-sidebar-mobile-v4__search-field--filled:focus-within{padding-right:0;box-shadow:inset 0 0 0 2px var(--sd-primary)}.sd-sidebar-mobile-v4__search-icon{flex:none}.sd-sidebar-mobile-v4__search-input{flex:1 1 auto;min-width:0;height:100%;margin:0;padding:0;border:0;outline:0;background:transparent;color:var(--sd-text);font:inherit;font-size:var(--sd-font-size-13, 13px)}.sd-sidebar-mobile-v4__search-input::placeholder{color:var(--sidebar-muted-ink);opacity:1}.sd-sidebar-mobile-v4__search-clear{width:44px;height:44px}.sd-sidebar-mobile-v4__list{flex:1 1 auto;min-height:0;box-sizing:border-box;padding:0 12px 12px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sidebar-line) transparent}.sd-sidebar-mobile-v4__section-label{margin:0;padding:14px 12px 4px;color:var(--sidebar-muted-ink);font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-16, 16px);letter-spacing:.3px}.sd-sidebar-mobile-v4__tree--separated{margin-top:var(--sd-space-16, 16px)}.sd-sidebar-mobile-v4__footer{flex:none;box-sizing:border-box;padding:12px 8px 12px 16px;border-top:1px solid var(--sidebar-line)}.sd-sidebar-mobile-v4__footer ::ng-deep .sd-layout-user-menu__popup{box-sizing:border-box;left:-4px;width:calc(var(--sidebar-drawer-width) - 24px)}@media(pointer:coarse){.sd-sidebar-mobile-v4__search-input{font-size:var(--sd-font-size-16, 16px)}}@media(prefers-reduced-motion:reduce){.sd-sidebar-mobile-v4__icon-button,.sd-sidebar-mobile-v4__search-clear,.sd-sidebar-mobile-v4__indicator{transition:none}}\n"] }]
|
|
4459
|
+
}], ctorParameters: () => [], propDecorators: { trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], list: [{ type: i0.ViewChild, args: ['list', { isSignal: true }] }], mainTree: [{ type: i0.ViewChild, args: ['mainTree', { isSignal: true }] }], menus: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }], userInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "userInfo", required: true }] }], sidebar: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebar", required: true }] }] } });
|
|
4460
|
+
/** First menu of every `id` in the tree, with the stable keys of its ancestor groups (keys as the V4 tree computes them). */
|
|
4461
|
+
function indexMenusById(menus) {
|
|
4462
|
+
const entries = new Map();
|
|
4463
|
+
const visit = (items, ancestors, ancestorKeys) => {
|
|
4464
|
+
for (const menu of items ?? []) {
|
|
4465
|
+
if (!menu || typeof menu !== 'object')
|
|
4466
|
+
continue;
|
|
4467
|
+
const key = getMenuStableKey(menu, ancestors);
|
|
4468
|
+
const id = typeof menu.id === 'string' ? menu.id.trim() : '';
|
|
4469
|
+
if (id && key && !entries.has(id))
|
|
4470
|
+
entries.set(id, { menu, key, ancestorKeys });
|
|
4471
|
+
if ('children' in menu && Array.isArray(menu.children)) {
|
|
4472
|
+
visit(menu.children, [...ancestors, menu.title ?? key], [...ancestorKeys, key]);
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
};
|
|
4476
|
+
visit(menus, [], []);
|
|
4477
|
+
return entries;
|
|
4478
|
+
}
|
|
4479
|
+
|
|
4480
|
+
class SdLayoutComponent {
|
|
4481
|
+
// ==========================================
|
|
4482
|
+
// INJECT SERVICES
|
|
4483
|
+
// ==========================================
|
|
4484
|
+
#menuPipe = inject(MenuPipe);
|
|
4485
|
+
#layoutService = inject(SdLayoutService);
|
|
4486
|
+
#responsiveService = inject(SdLayoutResponsiveService);
|
|
4487
|
+
#layoutConfiguration = inject(SD_LAYOUT_CONFIGURATION, { optional: true });
|
|
4488
|
+
// ==========================================
|
|
4489
|
+
// SIGNAL INPUTS
|
|
4490
|
+
// ==========================================
|
|
4491
|
+
menusInput = input([], { ...(ngDevMode ? { debugName: "menusInput" } : /* istanbul ignore next */ {}), alias: 'menus' });
|
|
4492
|
+
menus = computed(() => this.#menuPipe.transform(this.menusInput() || []), /* @ts-ignore */
|
|
4493
|
+
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
4494
|
+
// ==========================================
|
|
2649
4495
|
// CONSUME SHARED STATE
|
|
2650
4496
|
// ==========================================
|
|
2651
4497
|
userInfo = this.#layoutService.userInfo;
|
|
@@ -2665,15 +4511,31 @@ class SdLayoutComponent {
|
|
|
2665
4511
|
return sidebar?.version === 3 ? sidebar : undefined;
|
|
2666
4512
|
}, /* @ts-ignore */
|
|
2667
4513
|
...(ngDevMode ? [{ debugName: "sidebarV3" }] : /* istanbul ignore next */ []));
|
|
4514
|
+
// why: V4 là cấu hình duy nhất cần chuẩn hoá ở đây (INV-012) — bottomBar/itemShape/density/collapsedGroup có mặc định + sanitize.
|
|
4515
|
+
sidebarV4 = computed(() => {
|
|
4516
|
+
const sidebar = this.sidebar();
|
|
4517
|
+
return sidebar?.version === 4 ? normalizeSidebarConfiguration(sidebar) : undefined;
|
|
4518
|
+
}, /* @ts-ignore */
|
|
4519
|
+
...(ngDevMode ? [{ debugName: "sidebarV4" }] : /* istanbul ignore next */ []));
|
|
2668
4520
|
mobileBreakpoint = normalizeLayoutMobileBreakpoint(this.#layoutConfiguration?.mobileBreakpoint);
|
|
2669
4521
|
isMobile = computed(() => this.#responsiveService.isMobile(this.mobileBreakpoint), /* @ts-ignore */
|
|
2670
4522
|
...(ngDevMode ? [{ debugName: "isMobile" }] : /* istanbul ignore next */ []));
|
|
2671
4523
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2672
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdLayoutComponent, isStandalone: true, selector: "sd-layout", inputs: { menusInput: { classPropertyName: "menusInput", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-template #projectedContent>\n <ng-content></ng-content>\n</ng-template>\n\n@let _userInfo = userInfo();\n@let _sidebarV1 = sidebarV1();\n@let _sidebarV2 = sidebarV2();\n@let _sidebarV3 = sidebarV3();\n\n@if (_userInfo && _sidebarV1) {\n @if (!isMobile()) {\n <sd-sidebar-v1 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV1\" [isMobile]=\"false\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v1>\n } @else {\n <sd-sidebar-mobile-v1 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV1\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v1>\n }\n}\n\n@if (_userInfo && _sidebarV3) {\n @if (!isMobile()) {\n <sd-sidebar-v3 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV3\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v3>\n } @else {\n <sd-sidebar-mobile-v3 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV3\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v3>\n }\n}\n\n@if (_userInfo && _sidebarV2) {\n @if (!isMobile()) {\n <sd-sidebar-v2 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV2\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v2>\n } @else {\n <sd-sidebar-mobile-v2 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV2\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v2>\n }\n}\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: SdSidebarV1, selector: "sd-sidebar-v1", inputs: ["menus", "userInfo", "sidebar", "isMobile"] }, { kind: "component", type: SdSidebarMobileV1, selector: "sd-sidebar-mobile-v1", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarV2, selector: "sd-sidebar-v2", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarMobileV2, selector: "sd-sidebar-mobile-v2", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarV3, selector: "sd-sidebar-v3", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarMobileV3, selector: "sd-sidebar-mobile-v3", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4524
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdLayoutComponent, isStandalone: true, selector: "sd-layout", inputs: { menusInput: { classPropertyName: "menusInput", publicName: "menus", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ng-template #projectedContent>\n <ng-content></ng-content>\n</ng-template>\n\n@let _userInfo = userInfo();\n@let _sidebarV1 = sidebarV1();\n@let _sidebarV2 = sidebarV2();\n@let _sidebarV3 = sidebarV3();\n@let _sidebarV4 = sidebarV4();\n\n@if (_userInfo && _sidebarV1) {\n @if (!isMobile()) {\n <sd-sidebar-v1 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV1\" [isMobile]=\"false\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v1>\n } @else {\n <sd-sidebar-mobile-v1 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV1\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v1>\n }\n}\n\n@if (_userInfo && _sidebarV3) {\n @if (!isMobile()) {\n <sd-sidebar-v3 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV3\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v3>\n } @else {\n <sd-sidebar-mobile-v3 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV3\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v3>\n }\n}\n\n@if (_userInfo && _sidebarV4) {\n @if (!isMobile()) {\n <sd-sidebar-v4 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV4\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v4>\n } @else {\n <sd-sidebar-mobile-v4 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV4\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v4>\n }\n}\n\n@if (_userInfo && _sidebarV2) {\n @if (!isMobile()) {\n <sd-sidebar-v2 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV2\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v2>\n } @else {\n <sd-sidebar-mobile-v2 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV2\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v2>\n }\n}\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: SdSidebarV1, selector: "sd-sidebar-v1", inputs: ["menus", "userInfo", "sidebar", "isMobile"] }, { kind: "component", type: SdSidebarMobileV1, selector: "sd-sidebar-mobile-v1", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarV2, selector: "sd-sidebar-v2", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarMobileV2, selector: "sd-sidebar-mobile-v2", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarV3, selector: "sd-sidebar-v3", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarMobileV3, selector: "sd-sidebar-mobile-v3", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarV4, selector: "sd-sidebar-v4", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "component", type: SdSidebarMobileV4, selector: "sd-sidebar-mobile-v4", inputs: ["menus", "userInfo", "sidebar"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2673
4525
|
}
|
|
2674
4526
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdLayoutComponent, decorators: [{
|
|
2675
4527
|
type: Component,
|
|
2676
|
-
args: [{ selector: 'sd-layout', imports: [
|
|
4528
|
+
args: [{ selector: 'sd-layout', imports: [
|
|
4529
|
+
SdSidebarV1,
|
|
4530
|
+
SdSidebarMobileV1,
|
|
4531
|
+
SdSidebarV2,
|
|
4532
|
+
SdSidebarMobileV2,
|
|
4533
|
+
SdSidebarV3,
|
|
4534
|
+
SdSidebarMobileV3,
|
|
4535
|
+
SdSidebarV4,
|
|
4536
|
+
SdSidebarMobileV4,
|
|
4537
|
+
NgTemplateOutlet,
|
|
4538
|
+
], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #projectedContent>\n <ng-content></ng-content>\n</ng-template>\n\n@let _userInfo = userInfo();\n@let _sidebarV1 = sidebarV1();\n@let _sidebarV2 = sidebarV2();\n@let _sidebarV3 = sidebarV3();\n@let _sidebarV4 = sidebarV4();\n\n@if (_userInfo && _sidebarV1) {\n @if (!isMobile()) {\n <sd-sidebar-v1 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV1\" [isMobile]=\"false\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v1>\n } @else {\n <sd-sidebar-mobile-v1 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV1\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v1>\n }\n}\n\n@if (_userInfo && _sidebarV3) {\n @if (!isMobile()) {\n <sd-sidebar-v3 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV3\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v3>\n } @else {\n <sd-sidebar-mobile-v3 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV3\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v3>\n }\n}\n\n@if (_userInfo && _sidebarV4) {\n @if (!isMobile()) {\n <sd-sidebar-v4 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV4\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v4>\n } @else {\n <sd-sidebar-mobile-v4 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV4\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v4>\n }\n}\n\n@if (_userInfo && _sidebarV2) {\n @if (!isMobile()) {\n <sd-sidebar-v2 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV2\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-v2>\n } @else {\n <sd-sidebar-mobile-v2 [menus]=\"menus()\" [userInfo]=\"_userInfo\" [sidebar]=\"_sidebarV2\">\n <ng-container [ngTemplateOutlet]=\"projectedContent\"></ng-container>\n </sd-sidebar-mobile-v2>\n }\n}\n", styles: [":host{display:block}\n"] }]
|
|
2677
4539
|
}], propDecorators: { menusInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "menus", required: false }] }] } });
|
|
2678
4540
|
|
|
2679
4541
|
// End
|
|
@@ -2843,7 +4705,7 @@ let RootComponent$1 = class RootComponent {
|
|
|
2843
4705
|
void this.#router.navigateByUrl(this.#layoutService.homeUrl);
|
|
2844
4706
|
}
|
|
2845
4707
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2846
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: RootComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "@let _userInfo = userInfo();\n<sd-page>\n <div class=\"d-flex flex-column\" headerLeft>\n <div class=\"font-weight-medium fs-20\">{{ 'core.module.layout.greeting.hello' | sdTranslate: { name: _userInfo?.fullName ?? _userInfo?.email ?? _userInfo?.username ?? '' } }}</div>\n <span class=\"T12R text-secondary\">{{ todayInfo() }}</span>\n </div>\n\n <div class=\"h-full d-flex flex-column align-items-center\">\n <div class=\"h-full d-flex flex-column align-items-center justify-content-center text-center wrapper\">\n <img alt=\"not-found\" class=\"sd-image-not-found\" />\n <span class=\"T16M mt-24\">{{ 'core.module.layout.not-found.title' | sdTranslate }}</span>\n <span class=\"T16R text-secondary mt-4\">\n {{ 'core.module.layout.not-found.message' | sdTranslate }}\n </span>\n <sd-button class=\"mt-16\" type=\"fill\" color=\"primary\" (click)=\"reload()\" [title]=\"'core.module.layout.not-found.back' | sdTranslate\" prefixIcon=\"arrow_back\"> </sd-button>\n </div>\n </div>\n</sd-page>\n", styles: [".wrapper{width:300px}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdPageComponent, selector: "sd-page", inputs: ["title", "description", "noHeader"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
4708
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: RootComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "@let _userInfo = userInfo();\n<sd-page>\n <div class=\"d-flex flex-column\" headerLeft>\n <div class=\"font-weight-medium fs-20\">{{ 'core.module.layout.greeting.hello' | sdTranslate: { name: _userInfo?.fullName ?? _userInfo?.email ?? _userInfo?.username ?? '' } }}</div>\n <span class=\"T12R text-secondary\">{{ todayInfo() }}</span>\n </div>\n\n <div class=\"h-full d-flex flex-column align-items-center\">\n <div class=\"h-full d-flex flex-column align-items-center justify-content-center text-center wrapper\">\n <img alt=\"not-found\" class=\"sd-image-not-found\" />\n <span class=\"T16M mt-24\">{{ 'core.module.layout.not-found.title' | sdTranslate }}</span>\n <span class=\"T16R text-secondary mt-4\">\n {{ 'core.module.layout.not-found.message' | sdTranslate }}\n </span>\n <sd-button class=\"mt-16\" type=\"fill\" color=\"primary\" (click)=\"reload()\" [title]=\"'core.module.layout.not-found.back' | sdTranslate\" prefixIcon=\"arrow_back\"> </sd-button>\n </div>\n </div>\n</sd-page>\n", styles: [".wrapper{width:300px}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdPageComponent, selector: "sd-page", inputs: ["title", "description", "noHeader"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
2847
4709
|
};
|
|
2848
4710
|
RootComponent$1 = __decorate([
|
|
2849
4711
|
SdTabComponent({
|
|
@@ -2921,7 +4783,7 @@ let RootComponent = class RootComponent {
|
|
|
2921
4783
|
void this.#router.navigateByUrl(this.#layoutService.homeUrl);
|
|
2922
4784
|
}
|
|
2923
4785
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2924
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: RootComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "@let _userInfo = userInfo();\n<sd-page>\n <div class=\"d-flex flex-column\" headerLeft>\n <div class=\"font-weight-medium fs-20\">{{ 'core.module.layout.greeting.hello' | sdTranslate: { name: _userInfo?.fullName ?? _userInfo?.email ?? _userInfo?.username ?? '' } }}</div>\n <span class=\"T12R text-secondary\">{{ todayInfo() }}</span>\n </div>\n <div class=\"h-full d-flex flex-column align-items-center\">\n <div class=\"h-full d-flex flex-column align-items-center justify-content-center text-center wrapper\">\n <img alt=\"forbidden\" class=\"sd-image-forbidden\" />\n <span class=\"T16M mt-24\">{{ 'core.module.layout.forbidden.title' | sdTranslate }}</span>\n <span class=\"T14R text-secondary mt-4\"\n >{{ 'core.module.layout.forbidden.message' | sdTranslate }}</span\n >\n <sd-button class=\"mt-16\" type=\"fill\" color=\"primary\" (click)=\"reload()\" [title]=\"'core.module.layout.forbidden.back-home' | sdTranslate\"> </sd-button>\n </div>\n </div>\n</sd-page>\n", styles: [".wrapper{width:300px}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdPageComponent, selector: "sd-page", inputs: ["title", "description", "noHeader"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
4786
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: RootComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "@let _userInfo = userInfo();\n<sd-page>\n <div class=\"d-flex flex-column\" headerLeft>\n <div class=\"font-weight-medium fs-20\">{{ 'core.module.layout.greeting.hello' | sdTranslate: { name: _userInfo?.fullName ?? _userInfo?.email ?? _userInfo?.username ?? '' } }}</div>\n <span class=\"T12R text-secondary\">{{ todayInfo() }}</span>\n </div>\n <div class=\"h-full d-flex flex-column align-items-center\">\n <div class=\"h-full d-flex flex-column align-items-center justify-content-center text-center wrapper\">\n <img alt=\"forbidden\" class=\"sd-image-forbidden\" />\n <span class=\"T16M mt-24\">{{ 'core.module.layout.forbidden.title' | sdTranslate }}</span>\n <span class=\"T14R text-secondary mt-4\"\n >{{ 'core.module.layout.forbidden.message' | sdTranslate }}</span\n >\n <sd-button class=\"mt-16\" type=\"fill\" color=\"primary\" (click)=\"reload()\" [title]=\"'core.module.layout.forbidden.back-home' | sdTranslate\"> </sd-button>\n </div>\n </div>\n</sd-page>\n", styles: [".wrapper{width:300px}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdPageComponent, selector: "sd-page", inputs: ["title", "description", "noHeader"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
2925
4787
|
};
|
|
2926
4788
|
RootComponent = __decorate([
|
|
2927
4789
|
SdTabComponent({
|
|
@@ -3003,5 +4865,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
3003
4865
|
* Generated bundle index. Do not edit.
|
|
3004
4866
|
*/
|
|
3005
4867
|
|
|
3006
|
-
export { DEFAULT_LAYOUT_MOBILE_BREAKPOINT, ForbiddenModule, HighlightSearchPipe, HomeModule, MenuFocusPipe, MenuPipe, NotFoundModule, SD_LAYOUT_CONFIGURATION, SD_LAYOUT_DEMO_FALLBACK, SD_LAYOUT_STORAGE_NAMESPACE, SD_LAYOUT_VIEWPORT, SdLayoutComponent, SdLayoutMenuTreeComponent, SdLayoutModule, SdLayoutNavigationStateService, SdLayoutResponsiveService, SdLayoutService, SdLayoutStorageService, SdLayoutUserMenuComponent, SdPageComponent, SdSidebarMobileOverlay, SdSidebarMobileV1, SdSidebarMobileV2, SdSidebarMobileV3, SdSidebarV2, SdSidebarV3, collectMatchedMenuPaths, containsMenuPath, flattenMenuLeaves, getMenuStableKey, isMenuPathMatch, normalizeLayoutMobileBreakpoint, normalizeMenuPath, normalizeSidebarConfiguration, resolveActiveMenuPath, resolveMenuKeys, resolveSidebarV2Interaction, resolveSidebarV3Recent, resolveTabName, searchMenuLeaves, selectPrimaryMenuGroups };
|
|
4868
|
+
export { DEFAULT_LAYOUT_MOBILE_BREAKPOINT, ForbiddenModule, HighlightSearchPipe, HomeModule, MenuFocusPipe, MenuPipe, NotFoundModule, SD_LAYOUT_CONFIGURATION, SD_LAYOUT_CONTEXT_MARKER_KEY, SD_LAYOUT_CONTEXT_RUNTIME, SD_LAYOUT_DEMO_FALLBACK, SD_LAYOUT_STORAGE_NAMESPACE, SD_LAYOUT_VIEWPORT, SdLayoutComponent, SdLayoutContextService, SdLayoutContextSwitcher, SdLayoutMenuTreeComponent, SdLayoutModule, SdLayoutNavigationStateService, SdLayoutResponsiveService, SdLayoutService, SdLayoutStorageService, SdLayoutUserMenuComponent, SdPageComponent, SdSidebarMobileOverlay, SdSidebarMobileV1, SdSidebarMobileV2, SdSidebarMobileV3, SdSidebarMobileV4, SdSidebarV2, SdSidebarV3, SdSidebarV4, collectMatchedMenuPaths, containsMenuPath, createSdLayoutContextBrowserRuntime, flattenMenuLeaves, getMenuStableKey, groupMenusBySection, isMenuPathMatch, normalizeLayoutMobileBreakpoint, normalizeMenuPath, normalizeSidebarConfiguration, resolveActiveMenuPath, resolveMenuKeys, resolveMenuTrailing, resolveSidebarV2Interaction, resolveSidebarV3Recent, resolveTabName, searchAvailableMenuLeaves, searchMenuLeaves, selectPrimaryMenuGroups };
|
|
3007
4869
|
//# sourceMappingURL=sdcorejs-angular-modules-layout.mjs.map
|