@aseansc/ui 5.10.0 → 5.11.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to `@aseansc/ui` (trước đây `@asc/ui`) are documented h
4
4
 
5
5
  ---
6
6
 
7
+ ## [5.11.0] — 2026-11-17
8
+
9
+ ### Added
10
+
11
+ - **`AscLayout` — sidebar thu gọn dạng dải icon** (SEAHDR-514 B4, Figma "Trạng thái Thu gọn"). Bật bằng config `provideAscUI({ layout: { sidebarCollapse: 'rail' } })` hoặc input `[sidebarCollapse]="'rail'"` (input thắng config). Mặc định `'hidden'` = hành vi cũ (ẩn hẳn sidebar), app không bật thì không đổi gì.
12
+ - Bấm nút menu ở desktop (≥ 992px): sidebar co còn **84px** (`--layout-sidebar-rail-width`), item 60×40 chỉ có icon 20px; ẩn chữ, tiêu đề section, mũi tên. Topbar và nội dung co theo.
13
+ - Nhóm có menu con: bấm mở **popup** cạnh dải (rộng 200px, item 36px, gắn vào `body`), chọn mục thì điều hướng và đóng popup. Nhóm chứa trang đang mở được tô nền.
14
+ - Rê chuột vào mục trên dải: tooltip tên mục.
15
+ - Mục không có icon: hiện chữ cái đầu của label.
16
+ - Trạng thái thu gọn lưu `localStorage` (khóa `asc-layout.sidebar-collapsed`), mở lại app vẫn giữ.
17
+ - Màn < 992px giữ kiểu drawer như cũ.
18
+ - **`AscLayout.sideBarLogoCollapsed`** — template logo nhỏ hiện khi sidebar dạng dải. Không truyền thì dải vẫn dùng `sideBarLogo` (bị cắt nếu rộng hơn 60px).
19
+ - Type `AscSidebarCollapseMode`, `AscUILayoutConfig.sidebarCollapse`; `LayoutService.sidebarCollapse` / `isRail()`.
20
+
21
+ ---
22
+
7
23
  ## [5.10.0] — 2026-11-17
8
24
 
9
25
  ### Changed — thay đổi giao diện
@@ -127,6 +127,7 @@ const ASC_UI_DEFAULT_CONFIG = {
127
127
  },
128
128
  layout: {
129
129
  showFooter: true,
130
+ sidebarCollapse: 'hidden',
130
131
  },
131
132
  button: {
132
133
  size: 'md',
@@ -10313,6 +10314,17 @@ class LayoutService {
10313
10314
  ...(ngDevMode ? [{ debugName: "getSurface" }] : /* istanbul ignore next */ []));
10314
10315
  this.isOverlay = computed(() => this.layoutConfig().menuMode === 'overlay', /* @ts-ignore */
10315
10316
  ...(ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []));
10317
+ /** Kiểu thu gọn sidebar desktop — AscLayout đặt theo input / config `layout.sidebarCollapse`. */
10318
+ this.sidebarCollapse = signal('hidden', /* @ts-ignore */
10319
+ ...(ngDevMode ? [{ debugName: "sidebarCollapse" }] : /* istanbul ignore next */ []));
10320
+ /**
10321
+ * Sidebar đang thu gọn dạng dải icon (menu static + đã bấm thu gọn + kiểu 'rail').
10322
+ * Chỉ có hiệu lực giao diện ở desktop (CSS trong media ≥ 992px) — logic click dùng kèm `isDesktop()`.
10323
+ */
10324
+ this.isRail = computed(() => this.sidebarCollapse() === 'rail' &&
10325
+ this.layoutConfig().menuMode === 'static' &&
10326
+ !!this.layoutState().staticMenuDesktopInactive, /* @ts-ignore */
10327
+ ...(ngDevMode ? [{ debugName: "isRail" }] : /* istanbul ignore next */ []));
10316
10328
  this.transitionComplete = signal(false, /* @ts-ignore */
10317
10329
  ...(ngDevMode ? [{ debugName: "transitionComplete" }] : /* istanbul ignore next */ []));
10318
10330
  effect(() => {
@@ -10530,6 +10542,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10530
10542
  }]
10531
10543
  }], ctorParameters: () => [{ type: LayoutService }], propDecorators: { dropdownTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownTpl", required: false }] }], topBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "topBarLogo", required: false }] }], breadCrumb: [{ type: i0.Input, args: [{ isSignal: true, alias: "breadCrumb", required: false }] }], iconToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconToggle", required: false }] }] } });
10532
10544
 
10545
+ /** Khoảng cách popup dạng dải ↔ mép sidebar / mép màn hình */
10546
+ const RAIL_POPUP_GAP = 8;
10547
+ /** Menu con → model cho popup dạng dải: giữ điều hướng, bỏ icon; mục ẩn (`visible: false`) bị loại. */
10548
+ function toRailMenuModel(items) {
10549
+ return items
10550
+ .filter((it) => it.visible !== false)
10551
+ .map((it) => {
10552
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10553
+ const { icon, iconSrc, iconSize, iconWidth, iconHeight, items: children, ...rest } = it;
10554
+ return children?.length ? { ...rest, items: toRailMenuModel(children) } : rest;
10555
+ });
10556
+ }
10533
10557
  class AppMenuitem {
10534
10558
  get submenuExpanded() {
10535
10559
  return this.root || this.active;
@@ -10537,11 +10561,25 @@ class AppMenuitem {
10537
10561
  get activeClass() {
10538
10562
  return this.active && !this.root;
10539
10563
  }
10564
+ /** Chữ cái đầu của label — thay icon khi mục không có icon ở dạng dải */
10565
+ get initial() {
10566
+ return (this.item.label ?? '').trim().charAt(0).toUpperCase();
10567
+ }
10568
+ /** Tooltip tên mục chỉ hiện ở dạng dải (chữ bị ẩn), cho các mục hiển thị trên dải (không phải root) */
10569
+ get showRailTooltip() {
10570
+ return !this.root && this.layoutService.isRail();
10571
+ }
10540
10572
  constructor(router, layoutService) {
10541
10573
  this.router = router;
10542
10574
  this.layoutService = layoutService;
10543
10575
  this.active = false;
10544
10576
  this.key = '';
10577
+ /** Popup menu con khi sidebar dạng dải ('rail') */
10578
+ this.railMenu = viewChild('railMenu', /* @ts-ignore */
10579
+ ...(ngDevMode ? [{ debugName: "railMenu" }] : /* istanbul ignore next */ []));
10580
+ /** Mục menu con hiển thị trong popup — bỏ icon (Figma popup chỉ có chữ) */
10581
+ this.railModel = [];
10582
+ this.railAnchor = null;
10545
10583
  this.menuSourceSubscription = this.layoutService.menuSource$.subscribe((value) => {
10546
10584
  Promise.resolve(null).then(() => {
10547
10585
  if (value.routeEvent) {
@@ -10590,12 +10628,38 @@ class AppMenuitem {
10590
10628
  if (this.item.command) {
10591
10629
  this.item.command({ originalEvent: event, item: this.item });
10592
10630
  }
10631
+ // Dạng dải (desktop): nhóm có menu con → mở popup cạnh dải thay vì xổ xuống
10632
+ if (this.item.items && !this.root && this.layoutService.isRail() && this.layoutService.isDesktop()) {
10633
+ event.preventDefault();
10634
+ this.railModel = toRailMenuModel(this.item.items);
10635
+ this.railAnchor = event.currentTarget;
10636
+ this.railMenu()?.toggle(event);
10637
+ return;
10638
+ }
10593
10639
  // toggle active state
10594
10640
  if (this.item.items) {
10595
10641
  this.active = !this.active;
10596
10642
  }
10597
10643
  this.layoutService.onMenuStateChange({ key: this.key });
10598
10644
  }
10645
+ /**
10646
+ * p-menu popup tự đặt dưới mục được bấm — dời sang cạnh phải dải sidebar, ngang hàng với mục
10647
+ * (Figma "Trạng thái Thu gọn": popup nằm cạnh dải).
10648
+ */
10649
+ positionRailMenu() {
10650
+ const container = this.railMenu()?.container;
10651
+ const anchor = this.railAnchor;
10652
+ if (!container || !anchor)
10653
+ return;
10654
+ const sidebar = anchor.closest('.layout-sidebar');
10655
+ const anchorRect = anchor.getBoundingClientRect();
10656
+ const left = (sidebar?.getBoundingClientRect().right ?? anchorRect.right) + RAIL_POPUP_GAP;
10657
+ // Không để popup tràn đáy màn hình
10658
+ const maxTop = window.innerHeight - container.offsetHeight - RAIL_POPUP_GAP;
10659
+ const top = Math.max(RAIL_POPUP_GAP, Math.min(anchorRect.top, maxTop));
10660
+ container.style.left = `${left + window.scrollX}px`;
10661
+ container.style.top = `${top + window.scrollY}px`;
10662
+ }
10599
10663
  ngOnDestroy() {
10600
10664
  if (this.menuSourceSubscription) {
10601
10665
  this.menuSourceSubscription.unsubscribe();
@@ -10605,7 +10669,7 @@ class AppMenuitem {
10605
10669
  }
10606
10670
  }
10607
10671
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: AppMenuitem, deps: [{ token: i1$a.Router }, { token: LayoutService }], target: i0.ɵɵFactoryTarget.Component }); }
10608
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: AppMenuitem, isStandalone: true, selector: "[app-menuitem]", inputs: { item: "item", index: "index", root: "root", parentKey: "parentKey" }, host: { properties: { "class.layout-root-menuitem": "this.root", "class.active-menuitem": "this.activeClass" } }, ngImport: i0, template: `
10672
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: AppMenuitem, isStandalone: true, selector: "[app-menuitem]", inputs: { item: "item", index: "index", root: "root", parentKey: "parentKey" }, host: { properties: { "class.layout-root-menuitem": "this.root", "class.active-menuitem": "this.activeClass" } }, viewQueries: [{ propertyName: "railMenu", first: true, predicate: ["railMenu"], descendants: true, isSignal: true }], ngImport: i0, template: `
10609
10673
  <ng-container>
10610
10674
  @if (root && item.visible !== false) {
10611
10675
  <div class="layout-menuitem-root-text">
@@ -10621,24 +10685,11 @@ class AppMenuitem {
10621
10685
  [attr.target]="item.target"
10622
10686
  tabindex="0"
10623
10687
  pRipple
10688
+ [pTooltip]="item.label"
10689
+ tooltipPosition="right"
10690
+ [tooltipDisabled]="!showRailTooltip"
10624
10691
  >
10625
- @if (item.iconSrc) {
10626
- <asc-icon
10627
- [src]="item.iconSrc"
10628
- class="layout-menuitem-icon"
10629
- [size]="item.iconSize || '1em'"
10630
- [width]="item.iconWidth"
10631
- [height]="item.iconHeight"
10632
- />
10633
- } @else {
10634
- <i
10635
- [ngClass]="item.icon"
10636
- class="layout-menuitem-icon"
10637
- [style.font-size]="item.iconSize"
10638
- [style.width]="item.iconWidth"
10639
- [style.height]="item.iconHeight"
10640
- ></i>
10641
- }
10692
+ <ng-container [ngTemplateOutlet]="iconTpl"></ng-container>
10642
10693
  <span class="layout-menuitem-text">{{ item.label }}</span>
10643
10694
  @if (item.items) {
10644
10695
  <!-- Figma: CaretRight khi đóng, CaretDown khi mở (xoay 90° qua CSS) -->
@@ -10671,24 +10722,11 @@ class AppMenuitem {
10671
10722
  [attr.target]="item.target"
10672
10723
  tabindex="0"
10673
10724
  pRipple
10725
+ [pTooltip]="item.label"
10726
+ tooltipPosition="right"
10727
+ [tooltipDisabled]="!showRailTooltip"
10674
10728
  >
10675
- @if (item.iconSrc) {
10676
- <asc-icon
10677
- [src]="item.iconSrc"
10678
- class="layout-menuitem-icon"
10679
- [size]="item.iconSize || '1em'"
10680
- [width]="item.iconWidth"
10681
- [height]="item.iconHeight"
10682
- />
10683
- } @else {
10684
- <i
10685
- [ngClass]="item.icon"
10686
- class="layout-menuitem-icon"
10687
- [style.font-size]="item.iconSize"
10688
- [style.width]="item.iconWidth"
10689
- [style.height]="item.iconHeight"
10690
- ></i>
10691
- }
10729
+ <ng-container [ngTemplateOutlet]="iconTpl"></ng-container>
10692
10730
  <span class="layout-menuitem-text">{{ item.label }}</span>
10693
10731
  </a>
10694
10732
  }
@@ -10699,15 +10737,52 @@ class AppMenuitem {
10699
10737
  }
10700
10738
  </ul>
10701
10739
  }
10740
+
10741
+ <!-- Sidebar dạng dải ('rail'): nhóm có menu con mở popup cạnh dải, gắn vào body để không bị
10742
+ overflow:hidden của .layout-sidebar cắt -->
10743
+ @if (item.items && !root && layoutService.isRail()) {
10744
+ <p-menu
10745
+ #railMenu
10746
+ [model]="railModel"
10747
+ [popup]="true"
10748
+ appendTo="body"
10749
+ styleClass="asc-sidebar-rail-popup"
10750
+ [ariaLabel]="item.label"
10751
+ (onShow)="positionRailMenu()"
10752
+ />
10753
+ }
10702
10754
  </ng-container>
10703
- `, isInline: true, dependencies: [{ kind: "component", type: AppMenuitem, selector: "[app-menuitem]", inputs: ["item", "index", "root", "parentKey"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$a.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: i1$a.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i15.Ripple, selector: "[pRipple]" }, { kind: "component", type: AscIconComponent, selector: "asc-icon", inputs: ["src", "size", "width", "height"], outputs: ["loadError"] }, { kind: "component", type: AscSvgIconComponent, selector: "asc-svg-icon", inputs: ["name", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10755
+
10756
+ <ng-template #iconTpl>
10757
+ @if (item.iconSrc) {
10758
+ <asc-icon
10759
+ [src]="item.iconSrc"
10760
+ class="layout-menuitem-icon"
10761
+ [size]="item.iconSize || '1em'"
10762
+ [width]="item.iconWidth"
10763
+ [height]="item.iconHeight"
10764
+ />
10765
+ } @else if (item.icon) {
10766
+ <i
10767
+ [ngClass]="item.icon"
10768
+ class="layout-menuitem-icon"
10769
+ [style.font-size]="item.iconSize"
10770
+ [style.width]="item.iconWidth"
10771
+ [style.height]="item.iconHeight"
10772
+ ></i>
10773
+ } @else {
10774
+ <!-- Không có icon: dạng dải hiện chữ cái đầu (dạng đầy đủ ẩn qua CSS) -->
10775
+ <span class="layout-menuitem-icon layout-menuitem-initial" aria-hidden="true">{{ initial }}</span>
10776
+ }
10777
+ </ng-template>
10778
+ `, isInline: true, dependencies: [{ kind: "component", type: AppMenuitem, selector: "[app-menuitem]", inputs: ["item", "index", "root", "parentKey"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$a.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: i1$a.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i15.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: MenuModule }, { kind: "component", type: i14.Menu, selector: "p-menu", inputs: ["model", "popup", "style", "styleClass", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaLabel", "ariaLabelledBy", "id", "tabindex", "appendTo", "motionOptions"], outputs: ["onShow", "onHide", "onBlur", "onFocus"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i2.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "showOnEllipsis", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip", "pTooltipPT", "pTooltipUnstyled"] }, { kind: "component", type: AscIconComponent, selector: "asc-icon", inputs: ["src", "size", "width", "height"], outputs: ["loadError"] }, { kind: "component", type: AscSvgIconComponent, selector: "asc-svg-icon", inputs: ["name", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10704
10779
  }
10705
10780
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: AppMenuitem, decorators: [{
10706
10781
  type: Component,
10707
10782
  args: [{
10708
10783
  // eslint-disable-next-line @angular-eslint/component-selector
10709
10784
  selector: '[app-menuitem]',
10710
- imports: [CommonModule, RouterModule, RippleModule, AscIconComponent, AscSvgIconComponent],
10785
+ imports: [CommonModule, RouterModule, RippleModule, MenuModule, TooltipModule, AscIconComponent, AscSvgIconComponent],
10711
10786
  template: `
10712
10787
  <ng-container>
10713
10788
  @if (root && item.visible !== false) {
@@ -10724,24 +10799,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10724
10799
  [attr.target]="item.target"
10725
10800
  tabindex="0"
10726
10801
  pRipple
10802
+ [pTooltip]="item.label"
10803
+ tooltipPosition="right"
10804
+ [tooltipDisabled]="!showRailTooltip"
10727
10805
  >
10728
- @if (item.iconSrc) {
10729
- <asc-icon
10730
- [src]="item.iconSrc"
10731
- class="layout-menuitem-icon"
10732
- [size]="item.iconSize || '1em'"
10733
- [width]="item.iconWidth"
10734
- [height]="item.iconHeight"
10735
- />
10736
- } @else {
10737
- <i
10738
- [ngClass]="item.icon"
10739
- class="layout-menuitem-icon"
10740
- [style.font-size]="item.iconSize"
10741
- [style.width]="item.iconWidth"
10742
- [style.height]="item.iconHeight"
10743
- ></i>
10744
- }
10806
+ <ng-container [ngTemplateOutlet]="iconTpl"></ng-container>
10745
10807
  <span class="layout-menuitem-text">{{ item.label }}</span>
10746
10808
  @if (item.items) {
10747
10809
  <!-- Figma: CaretRight khi đóng, CaretDown khi mở (xoay 90° qua CSS) -->
@@ -10774,24 +10836,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10774
10836
  [attr.target]="item.target"
10775
10837
  tabindex="0"
10776
10838
  pRipple
10839
+ [pTooltip]="item.label"
10840
+ tooltipPosition="right"
10841
+ [tooltipDisabled]="!showRailTooltip"
10777
10842
  >
10778
- @if (item.iconSrc) {
10779
- <asc-icon
10780
- [src]="item.iconSrc"
10781
- class="layout-menuitem-icon"
10782
- [size]="item.iconSize || '1em'"
10783
- [width]="item.iconWidth"
10784
- [height]="item.iconHeight"
10785
- />
10786
- } @else {
10787
- <i
10788
- [ngClass]="item.icon"
10789
- class="layout-menuitem-icon"
10790
- [style.font-size]="item.iconSize"
10791
- [style.width]="item.iconWidth"
10792
- [style.height]="item.iconHeight"
10793
- ></i>
10794
- }
10843
+ <ng-container [ngTemplateOutlet]="iconTpl"></ng-container>
10795
10844
  <span class="layout-menuitem-text">{{ item.label }}</span>
10796
10845
  </a>
10797
10846
  }
@@ -10802,7 +10851,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10802
10851
  }
10803
10852
  </ul>
10804
10853
  }
10854
+
10855
+ <!-- Sidebar dạng dải ('rail'): nhóm có menu con mở popup cạnh dải, gắn vào body để không bị
10856
+ overflow:hidden của .layout-sidebar cắt -->
10857
+ @if (item.items && !root && layoutService.isRail()) {
10858
+ <p-menu
10859
+ #railMenu
10860
+ [model]="railModel"
10861
+ [popup]="true"
10862
+ appendTo="body"
10863
+ styleClass="asc-sidebar-rail-popup"
10864
+ [ariaLabel]="item.label"
10865
+ (onShow)="positionRailMenu()"
10866
+ />
10867
+ }
10805
10868
  </ng-container>
10869
+
10870
+ <ng-template #iconTpl>
10871
+ @if (item.iconSrc) {
10872
+ <asc-icon
10873
+ [src]="item.iconSrc"
10874
+ class="layout-menuitem-icon"
10875
+ [size]="item.iconSize || '1em'"
10876
+ [width]="item.iconWidth"
10877
+ [height]="item.iconHeight"
10878
+ />
10879
+ } @else if (item.icon) {
10880
+ <i
10881
+ [ngClass]="item.icon"
10882
+ class="layout-menuitem-icon"
10883
+ [style.font-size]="item.iconSize"
10884
+ [style.width]="item.iconWidth"
10885
+ [style.height]="item.iconHeight"
10886
+ ></i>
10887
+ } @else {
10888
+ <!-- Không có icon: dạng dải hiện chữ cái đầu (dạng đầy đủ ẩn qua CSS) -->
10889
+ <span class="layout-menuitem-icon layout-menuitem-initial" aria-hidden="true">{{ initial }}</span>
10890
+ }
10891
+ </ng-template>
10806
10892
  `,
10807
10893
  standalone: true,
10808
10894
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -10821,7 +10907,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10821
10907
  }], activeClass: [{
10822
10908
  type: HostBinding,
10823
10909
  args: ['class.active-menuitem']
10824
- }] } });
10910
+ }], railMenu: [{ type: i0.ViewChild, args: ['railMenu', { isSignal: true }] }] } });
10825
10911
 
10826
10912
  class AppMenu {
10827
10913
  constructor() {
@@ -10869,14 +10955,27 @@ class AppSidebar {
10869
10955
  ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
10870
10956
  this.sideBarLogo = input(/* @ts-ignore */
10871
10957
  ...(ngDevMode ? [undefined, { debugName: "sideBarLogo" }] : /* istanbul ignore next */ []));
10958
+ /** Logo nhỏ khi sidebar thu gọn dạng dải ('rail') */
10959
+ this.sideBarLogoCollapsed = input(/* @ts-ignore */
10960
+ ...(ngDevMode ? [undefined, { debugName: "sideBarLogoCollapsed" }] : /* istanbul ignore next */ []));
10872
10961
  }
10873
10962
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: AppSidebar, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
10874
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: AppSidebar, isStandalone: true, selector: "asc-sidebar", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, sideBarLogo: { classPropertyName: "sideBarLogo", publicName: "sideBarLogo", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
10963
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: AppSidebar, isStandalone: true, selector: "asc-sidebar", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, sideBarLogo: { classPropertyName: "sideBarLogo", publicName: "sideBarLogo", isSignal: true, isRequired: false, transformFunction: null }, sideBarLogoCollapsed: { classPropertyName: "sideBarLogoCollapsed", publicName: "sideBarLogoCollapsed", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
10875
10964
 
10876
10965
  <div class="layout-sidebar">
10877
- @if (sideBarLogo()) {
10878
- <div class="layout-sidebar-logo">
10879
- <ng-template [ngTemplateOutlet]="sideBarLogo()"></ng-template>
10966
+ @if (sideBarLogo() || sideBarLogoCollapsed()) {
10967
+ <div class="layout-sidebar-logo" [class.layout-sidebar-logo--has-collapsed]="!!sideBarLogoCollapsed()">
10968
+ <!-- Có logo thu gọn thì 2 bản cùng render, CSS đổi bản hiện khi sidebar dạng dải ('rail') -->
10969
+ @if (sideBarLogo()) {
10970
+ <div class="layout-sidebar-logo-full">
10971
+ <ng-template [ngTemplateOutlet]="sideBarLogo()"></ng-template>
10972
+ </div>
10973
+ }
10974
+ @if (sideBarLogoCollapsed()) {
10975
+ <div class="layout-sidebar-logo-collapsed">
10976
+ <ng-template [ngTemplateOutlet]="sideBarLogoCollapsed()"></ng-template>
10977
+ </div>
10978
+ }
10880
10979
  </div>
10881
10980
  }
10882
10981
  <!-- Cuộn ở lớp trong để scrollbar bị clip theo border-radius của .layout-sidebar -->
@@ -10897,9 +10996,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10897
10996
  template: `
10898
10997
 
10899
10998
  <div class="layout-sidebar">
10900
- @if (sideBarLogo()) {
10901
- <div class="layout-sidebar-logo">
10902
- <ng-template [ngTemplateOutlet]="sideBarLogo()"></ng-template>
10999
+ @if (sideBarLogo() || sideBarLogoCollapsed()) {
11000
+ <div class="layout-sidebar-logo" [class.layout-sidebar-logo--has-collapsed]="!!sideBarLogoCollapsed()">
11001
+ <!-- Có logo thu gọn thì 2 bản cùng render, CSS đổi bản hiện khi sidebar dạng dải ('rail') -->
11002
+ @if (sideBarLogo()) {
11003
+ <div class="layout-sidebar-logo-full">
11004
+ <ng-template [ngTemplateOutlet]="sideBarLogo()"></ng-template>
11005
+ </div>
11006
+ }
11007
+ @if (sideBarLogoCollapsed()) {
11008
+ <div class="layout-sidebar-logo-collapsed">
11009
+ <ng-template [ngTemplateOutlet]="sideBarLogoCollapsed()"></ng-template>
11010
+ </div>
11011
+ }
10903
11012
  </div>
10904
11013
  }
10905
11014
  <!-- Cuộn ở lớp trong để scrollbar bị clip theo border-radius của .layout-sidebar -->
@@ -10910,7 +11019,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10910
11019
  </div>
10911
11020
  `,
10912
11021
  }]
10913
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], sideBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideBarLogo", required: false }] }] } });
11022
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], sideBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideBarLogo", required: false }] }], sideBarLogoCollapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideBarLogoCollapsed", required: false }] }] } });
10914
11023
 
10915
11024
  class AppFooter {
10916
11025
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: AppFooter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -10930,6 +11039,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
10930
11039
  }]
10931
11040
  }] });
10932
11041
 
11042
+ /** Khóa localStorage lưu trạng thái thu gọn sidebar (chỉ dùng ở kiểu 'rail'). */
11043
+ const ASC_SIDEBAR_COLLAPSED_STORAGE_KEY = 'asc-layout.sidebar-collapsed';
10933
11044
  class AscLayout {
10934
11045
  constructor(layoutService, renderer, router) {
10935
11046
  this.layoutService = layoutService;
@@ -10939,6 +11050,9 @@ class AscLayout {
10939
11050
  ...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
10940
11051
  this.sideBarLogo = input(/* @ts-ignore */
10941
11052
  ...(ngDevMode ? [undefined, { debugName: "sideBarLogo" }] : /* istanbul ignore next */ []));
11053
+ /** Logo nhỏ hiện khi sidebar thu gọn dạng dải ('rail'). Không truyền → vẫn dùng `sideBarLogo`. */
11054
+ this.sideBarLogoCollapsed = input(/* @ts-ignore */
11055
+ ...(ngDevMode ? [undefined, { debugName: "sideBarLogoCollapsed" }] : /* istanbul ignore next */ []));
10942
11056
  this.topBarLogo = input(/* @ts-ignore */
10943
11057
  ...(ngDevMode ? [undefined, { debugName: "topBarLogo" }] : /* istanbul ignore next */ []));
10944
11058
  this.iconToggle = input(/* @ts-ignore */
@@ -10955,6 +11069,15 @@ class AscLayout {
10955
11069
  this.config = inject(ASC_UI_CONFIG, { optional: true }) ?? ASC_UI_DEFAULT_CONFIG;
10956
11070
  this.resolvedShowFooter = computed(() => this.showFooter() ?? this.config.layout?.showFooter ?? true, /* @ts-ignore */
10957
11071
  ...(ngDevMode ? [{ debugName: "resolvedShowFooter" }] : /* istanbul ignore next */ []));
11072
+ /**
11073
+ * Kiểu thu gọn sidebar desktop: 'hidden' (ẩn hẳn) | 'rail' (dải icon 84px).
11074
+ * Không truyền thì fallback về config.layout.sidebarCollapse → 'hidden'.
11075
+ */
11076
+ this.sidebarCollapse = input(undefined, /* @ts-ignore */
11077
+ ...(ngDevMode ? [{ debugName: "sidebarCollapse" }] : /* istanbul ignore next */ []));
11078
+ this.resolvedSidebarCollapse = computed(() => this.sidebarCollapse() ?? this.config.layout?.sidebarCollapse ?? 'hidden', /* @ts-ignore */
11079
+ ...(ngDevMode ? [{ debugName: "resolvedSidebarCollapse" }] : /* istanbul ignore next */ []));
11080
+ this.collapsedRestored = false;
10958
11081
  this.menuOutsideClickListener = null;
10959
11082
  this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => {
10960
11083
  if (!this.menuOutsideClickListener) {
@@ -10971,13 +11094,34 @@ class AscLayout {
10971
11094
  this.router.events.pipe(filter$1((event) => event instanceof NavigationEnd)).subscribe(() => {
10972
11095
  this.hideMenu();
10973
11096
  });
11097
+ // Đồng bộ kiểu thu gọn vào LayoutService; ở kiểu 'rail' khôi phục / lưu trạng thái thu gọn qua localStorage
11098
+ effect(() => {
11099
+ const mode = this.resolvedSidebarCollapse();
11100
+ const collapsed = !!this.layoutService.layoutState().staticMenuDesktopInactive;
11101
+ untracked(() => {
11102
+ this.layoutService.sidebarCollapse.set(mode);
11103
+ if (mode !== 'rail')
11104
+ return;
11105
+ if (!this.collapsedRestored) {
11106
+ this.collapsedRestored = true;
11107
+ if (readStoredCollapsed() && !collapsed) {
11108
+ this.layoutService.layoutState.update((prev) => ({ ...prev, staticMenuDesktopInactive: true }));
11109
+ return;
11110
+ }
11111
+ }
11112
+ writeStoredCollapsed(collapsed);
11113
+ });
11114
+ });
10974
11115
  }
10975
11116
  get containerClass() {
11117
+ const isStatic = this.layoutService.layoutConfig().menuMode === 'static';
11118
+ const collapsed = !!this.layoutService.layoutState().staticMenuDesktopInactive;
11119
+ const rail = this.layoutService.sidebarCollapse() === 'rail';
10976
11120
  return {
10977
11121
  'layout-overlay': this.layoutService.layoutConfig().menuMode === 'overlay',
10978
- 'layout-static': this.layoutService.layoutConfig().menuMode === 'static',
10979
- 'layout-static-inactive': this.layoutService.layoutState().staticMenuDesktopInactive &&
10980
- this.layoutService.layoutConfig().menuMode === 'static',
11122
+ 'layout-static': isStatic,
11123
+ 'layout-static-inactive': isStatic && collapsed && !rail,
11124
+ 'layout-sidebar-rail': isStatic && collapsed && rail,
10981
11125
  'layout-overlay-active': this.layoutService.layoutState().overlayMenuActive,
10982
11126
  'layout-mobile-active': this.layoutService.layoutState().staticMenuMobileActive,
10983
11127
  };
@@ -11029,7 +11173,7 @@ class AscLayout {
11029
11173
  }
11030
11174
  }
11031
11175
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: AscLayout, deps: [{ token: LayoutService }, { token: i0.Renderer2 }, { token: i1$a.Router }], target: i0.ɵɵFactoryTarget.Component }); }
11032
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: AscLayout, isStandalone: true, selector: "asc-layout", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, sideBarLogo: { classPropertyName: "sideBarLogo", publicName: "sideBarLogo", isSignal: true, isRequired: false, transformFunction: null }, topBarLogo: { classPropertyName: "topBarLogo", publicName: "topBarLogo", isSignal: true, isRequired: false, transformFunction: null }, iconToggle: { classPropertyName: "iconToggle", publicName: "iconToggle", isSignal: true, isRequired: false, transformFunction: null }, breadCrumb: { classPropertyName: "breadCrumb", publicName: "breadCrumb", isSignal: true, isRequired: false, transformFunction: null }, dropdownTpl: { classPropertyName: "dropdownTpl", publicName: "dropdownTpl", isSignal: true, isRequired: false, transformFunction: null }, footerSidebarTpl: { classPropertyName: "footerSidebarTpl", publicName: "footerSidebarTpl", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
11176
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: AscLayout, isStandalone: true, selector: "asc-layout", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, sideBarLogo: { classPropertyName: "sideBarLogo", publicName: "sideBarLogo", isSignal: true, isRequired: false, transformFunction: null }, sideBarLogoCollapsed: { classPropertyName: "sideBarLogoCollapsed", publicName: "sideBarLogoCollapsed", isSignal: true, isRequired: false, transformFunction: null }, topBarLogo: { classPropertyName: "topBarLogo", publicName: "topBarLogo", isSignal: true, isRequired: false, transformFunction: null }, iconToggle: { classPropertyName: "iconToggle", publicName: "iconToggle", isSignal: true, isRequired: false, transformFunction: null }, breadCrumb: { classPropertyName: "breadCrumb", publicName: "breadCrumb", isSignal: true, isRequired: false, transformFunction: null }, dropdownTpl: { classPropertyName: "dropdownTpl", publicName: "dropdownTpl", isSignal: true, isRequired: false, transformFunction: null }, footerSidebarTpl: { classPropertyName: "footerSidebarTpl", publicName: "footerSidebarTpl", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, sidebarCollapse: { classPropertyName: "sidebarCollapse", publicName: "sidebarCollapse", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
11033
11177
  <div class="layout-wrapper" [ngClass]="containerClass">
11034
11178
  <asc-topbar
11035
11179
  [iconToggle]="iconToggle()"
@@ -11037,7 +11181,11 @@ class AscLayout {
11037
11181
  [topBarLogo]="topBarLogo()"
11038
11182
  [dropdownTpl]="dropdownTpl()"
11039
11183
  ></asc-topbar>
11040
- <asc-sidebar [sideBarLogo]="sideBarLogo()" [menuItems]="menuItems()">
11184
+ <asc-sidebar
11185
+ [sideBarLogo]="sideBarLogo()"
11186
+ [sideBarLogoCollapsed]="sideBarLogoCollapsed()"
11187
+ [menuItems]="menuItems()"
11188
+ >
11041
11189
  <ng-container [ngTemplateOutlet]="footerSidebarTpl()"></ng-container>
11042
11190
  </asc-sidebar>
11043
11191
  <div class="layout-main-container">
@@ -11050,7 +11198,7 @@ class AscLayout {
11050
11198
  </div>
11051
11199
  <div class="layout-mask animate-fadein"></div>
11052
11200
  </div>
11053
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AppTopbar, selector: "asc-topbar", inputs: ["dropdownTpl", "topBarLogo", "breadCrumb", "iconToggle"] }, { kind: "component", type: AppSidebar, selector: "asc-sidebar", inputs: ["menuItems", "sideBarLogo"] }, { kind: "ngmodule", type: RouterModule }, { kind: "component", type: AppFooter, selector: "asc-footer" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11201
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AppTopbar, selector: "asc-topbar", inputs: ["dropdownTpl", "topBarLogo", "breadCrumb", "iconToggle"] }, { kind: "component", type: AppSidebar, selector: "asc-sidebar", inputs: ["menuItems", "sideBarLogo", "sideBarLogoCollapsed"] }, { kind: "ngmodule", type: RouterModule }, { kind: "component", type: AppFooter, selector: "asc-footer" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11054
11202
  }
11055
11203
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: AscLayout, decorators: [{
11056
11204
  type: Component,
@@ -11067,7 +11215,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
11067
11215
  [topBarLogo]="topBarLogo()"
11068
11216
  [dropdownTpl]="dropdownTpl()"
11069
11217
  ></asc-topbar>
11070
- <asc-sidebar [sideBarLogo]="sideBarLogo()" [menuItems]="menuItems()">
11218
+ <asc-sidebar
11219
+ [sideBarLogo]="sideBarLogo()"
11220
+ [sideBarLogoCollapsed]="sideBarLogoCollapsed()"
11221
+ [menuItems]="menuItems()"
11222
+ >
11071
11223
  <ng-container [ngTemplateOutlet]="footerSidebarTpl()"></ng-container>
11072
11224
  </asc-sidebar>
11073
11225
  <div class="layout-main-container">
@@ -11082,7 +11234,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
11082
11234
  </div>
11083
11235
  `,
11084
11236
  }]
11085
- }], ctorParameters: () => [{ type: LayoutService }, { type: i0.Renderer2 }, { type: i1$a.Router }], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], sideBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideBarLogo", required: false }] }], topBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "topBarLogo", required: false }] }], iconToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconToggle", required: false }] }], breadCrumb: [{ type: i0.Input, args: [{ isSignal: true, alias: "breadCrumb", required: false }] }], dropdownTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownTpl", required: false }] }], footerSidebarTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "footerSidebarTpl", required: false }] }], showFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooter", required: false }] }] } });
11237
+ }], ctorParameters: () => [{ type: LayoutService }, { type: i0.Renderer2 }, { type: i1$a.Router }], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], sideBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideBarLogo", required: false }] }], sideBarLogoCollapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideBarLogoCollapsed", required: false }] }], topBarLogo: [{ type: i0.Input, args: [{ isSignal: true, alias: "topBarLogo", required: false }] }], iconToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconToggle", required: false }] }], breadCrumb: [{ type: i0.Input, args: [{ isSignal: true, alias: "breadCrumb", required: false }] }], dropdownTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownTpl", required: false }] }], footerSidebarTpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "footerSidebarTpl", required: false }] }], showFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooter", required: false }] }], sidebarCollapse: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebarCollapse", required: false }] }] } });
11238
+ // localStorage có thể ném lỗi (chế độ riêng tư, chặn dữ liệu trang) — lỗi thì coi như không lưu
11239
+ function readStoredCollapsed() {
11240
+ try {
11241
+ return localStorage.getItem(ASC_SIDEBAR_COLLAPSED_STORAGE_KEY) === '1';
11242
+ }
11243
+ catch {
11244
+ return false;
11245
+ }
11246
+ }
11247
+ function writeStoredCollapsed(collapsed) {
11248
+ try {
11249
+ localStorage.setItem(ASC_SIDEBAR_COLLAPSED_STORAGE_KEY, collapsed ? '1' : '0');
11250
+ }
11251
+ catch {
11252
+ /* bỏ qua */
11253
+ }
11254
+ }
11086
11255
 
11087
11256
  class AscBreadcrumb {
11088
11257
  constructor() {