@sdcorejs/angular 22.2.13 → 22.2.15

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.
Files changed (42) hide show
  1. package/assets/STYLE-GUIDE.md +138 -10
  2. package/assets/scss/core/form.scss +18 -2
  3. package/assets/scss/core/utilities/_base.scss +3 -3
  4. package/assets/scss/themes/_presets.scss +52 -0
  5. package/assets/scss/themes/default.scss +39 -11
  6. package/assets/scss/themes/material-theme.scss +2 -2
  7. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +1 -1
  8. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
  9. package/fesm2022/sdcorejs-angular-components-button.mjs +13 -2
  10. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  11. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2679 -0
  12. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -0
  13. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +3 -3
  14. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  15. package/fesm2022/sdcorejs-angular-components-preview.mjs +2 -2
  16. package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
  17. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +95 -7
  18. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  19. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +10 -4
  20. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  21. package/fesm2022/sdcorejs-angular-components-tab.mjs +56 -3
  22. package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
  23. package/fesm2022/sdcorejs-angular-components-table.mjs +510 -79
  24. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  25. package/fesm2022/sdcorejs-angular-components.mjs +1 -0
  26. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  27. package/fesm2022/sdcorejs-angular-forms-select.mjs +2 -2
  28. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  29. package/fesm2022/sdcorejs-angular-i18n.mjs +430 -0
  30. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  31. package/fesm2022/sdcorejs-angular-modules-icon.mjs +6 -0
  32. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
  33. package/fesm2022/sdcorejs-angular-modules-layout.mjs +2 -2
  34. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  35. package/package.json +5 -1
  36. package/types/sdcorejs-angular-components-button.d.ts +5 -0
  37. package/types/sdcorejs-angular-components-file-explorer.d.ts +500 -0
  38. package/types/sdcorejs-angular-components-side-drawer.d.ts +13 -2
  39. package/types/sdcorejs-angular-components-tab.d.ts +8 -2
  40. package/types/sdcorejs-angular-components-table.d.ts +220 -6
  41. package/types/sdcorejs-angular-components.d.ts +1 -0
  42. package/types/sdcorejs-angular-i18n.d.ts +85 -0
@@ -4,7 +4,7 @@ import { CdkPortal, DomPortalOutlet, PortalModule } from '@angular/cdk/portal';
4
4
  import * as i1 from '@angular/common';
5
5
  import { DOCUMENT, CommonModule } from '@angular/common';
6
6
  import * as i0 from '@angular/core';
7
- import { inject, Injectable, viewChild, input, booleanAttribute, computed, output, signal, ViewContainerRef, ApplicationRef, Injector, ChangeDetectorRef, DestroyRef, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
7
+ import { inject, Injectable, viewChild, input, booleanAttribute, computed, output, signal, ElementRef, ViewContainerRef, ApplicationRef, Injector, ChangeDetectorRef, DestroyRef, afterNextRender, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
8
8
  import { SdLoadingService } from '@sdcorejs/angular/services';
9
9
  import { Utilities } from '@sdcorejs/utils/fns';
10
10
  import { Subject, fromEvent, merge } from 'rxjs';
@@ -80,6 +80,14 @@ class SdSideDrawer {
80
80
  disableBackdropClose = input(false, { ...(ngDevMode ? { debugName: "disableBackdropClose" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
81
81
  beforeClose = input(undefined, /* @ts-ignore */
82
82
  ...(ngDevMode ? [{ debugName: "beforeClose" }] : /* istanbul ignore next */ []));
83
+ /**
84
+ * Element the drawer opens inside, for example a template reference: `[container]="area"`.
85
+ * Panel and backdrop then cover only that element and page scroll stays unlocked; a statically
86
+ * positioned container becomes `position: relative` while the drawer lives in it.
87
+ * `null` (default): the drawer covers the viewport.
88
+ */
89
+ container = input(null, /* @ts-ignore */
90
+ ...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
83
91
  // Custom CSS class added to the root side-drawer container
84
92
  drawerClass = input('', /* @ts-ignore */
85
93
  ...(ngDevMode ? [{ debugName: "drawerClass" }] : /* istanbul ignore next */ []));
@@ -99,12 +107,23 @@ class SdSideDrawer {
99
107
  ...(ngDevMode ? [{ debugName: "dataOpened" }] : /* istanbul ignore next */ []));
100
108
  dataLoading = computed(() => (this.#isLoadingSignal() ? 'true' : 'false'), /* @ts-ignore */
101
109
  ...(ngDevMode ? [{ debugName: "dataLoading" }] : /* istanbul ignore next */ []));
110
+ #containerElement = computed(() => {
111
+ const container = this.container();
112
+ return container instanceof ElementRef ? container.nativeElement : (container ?? null);
113
+ }, /* @ts-ignore */
114
+ ...(ngDevMode ? [{ debugName: "#containerElement" }] : /* istanbul ignore next */ []));
115
+ contained = computed(() => this.#containerElement() !== null, /* @ts-ignore */
116
+ ...(ngDevMode ? [{ debugName: "contained" }] : /* istanbul ignore next */ []));
102
117
  isHovered$;
103
118
  #destroy$ = new Subject();
104
119
  // Instance này có đang giữ 1 khoá scroll hay không — giữ cho lock/release luôn cân bằng
105
120
  // dù open()/close() bị gọi lặp.
106
121
  #holdsScrollLock = false;
107
122
  #closeRequest;
123
+ // Lớp bọc do drawer tự tạo trong [container]; null khi drawer nằm ở body.
124
+ #layer = null;
125
+ #placedIn = null;
126
+ #restoreContainerPosition = null;
108
127
  #viewContainerRef = inject(ViewContainerRef);
109
128
  #ar = inject(ApplicationRef);
110
129
  #injector = inject(Injector);
@@ -112,15 +131,27 @@ class SdSideDrawer {
112
131
  #loadingService = inject(SdLoadingService);
113
132
  #destroyRef = inject(DestroyRef);
114
133
  #scrollLock = inject(SdBodyScrollLockService);
134
+ #document = inject(DOCUMENT);
115
135
  constructor() {
116
136
  // Thay thế ngAfterViewInit, tự động chạy nội dung này khi DOM sẵn sàng để render
117
137
  afterNextRender(() => {
118
138
  // 1. Gắn portal vào body và lưu lại EmbeddedViewRef
119
139
  const outlet = new DomPortalOutlet(document.body, this.#ar, this.#injector);
120
140
  this.#embeddedViewRef = outlet.attachTemplatePortal(this.portal());
121
- // 2. Setup sự kiện hover ngay sau khi DOM thật đã được in ra
141
+ // 2. Có [container] thì chuyển DOM của drawer vào vùng chứa đó
142
+ this.#place(this.#containerElement());
143
+ // 3. Setup sự kiện hover ngay sau khi DOM thật đã được in ra
122
144
  this.#setupHoverSubscription();
123
145
  });
146
+ // [container] đổi sau khi portal đã gắn: chuyển DOM sang vùng mới và cân lại khoá scroll body.
147
+ effect(() => {
148
+ const container = this.#containerElement();
149
+ untracked(() => {
150
+ if (this.#embeddedViewRef)
151
+ this.#place(container);
152
+ this.#syncScrollLock();
153
+ });
154
+ });
124
155
  // Thay thế ngOnDestroy bằng logic destroy trực tiếp
125
156
  this.#destroyRef.onDestroy(() => {
126
157
  this.#destroy$.next();
@@ -128,6 +159,9 @@ class SdSideDrawer {
128
159
  if (this.#embeddedViewRef) {
129
160
  this.#embeddedViewRef.destroy();
130
161
  }
162
+ // Drawer trong [container]: gỡ lớp bọc và trả lại position ban đầu của vùng chứa.
163
+ this.#layer?.remove();
164
+ this.#restoreContainerPosition?.();
131
165
  // Destroy khi đang mở cũng phải nhả khoá, nếu không ref-count kẹt > 0 và trang khoá scroll mãi.
132
166
  this.#releaseScrollLock();
133
167
  });
@@ -135,8 +169,9 @@ class SdSideDrawer {
135
169
  open = () => {
136
170
  this.#ref.markForCheck();
137
171
  this.#isOpenedSignal.set(true);
138
- // Chặn scroll ở document body qua khoá ref-count dùng chung (stack-safe với drawer lồng nhau)
139
- this.#acquireScrollLock();
172
+ // Chặn scroll ở document body qua khoá ref-count dùng chung (stack-safe với drawer lồng nhau).
173
+ // Drawer mở trong [container] không khoá: phần còn lại của trang vẫn dùng được.
174
+ this.#syncScrollLock();
140
175
  };
141
176
  close = () => {
142
177
  if (this.beforeClose()) {
@@ -180,6 +215,12 @@ class SdSideDrawer {
180
215
  // Khôi phục lại scroll ở document body (chỉ thật sự khôi phục khi drawer cuối cùng nhả khoá)
181
216
  this.#releaseScrollLock();
182
217
  };
218
+ #syncScrollLock() {
219
+ if (this.#isOpenedSignal() && !this.contained())
220
+ this.#acquireScrollLock();
221
+ else
222
+ this.#releaseScrollLock();
223
+ }
183
224
  #acquireScrollLock() {
184
225
  if (this.#holdsScrollLock)
185
226
  return;
@@ -192,6 +233,53 @@ class SdSideDrawer {
192
233
  this.#holdsScrollLock = false;
193
234
  this.#scrollLock.release();
194
235
  }
236
+ /** Chuyển DOM của drawer vào `container`, hoặc về lại `<body>` khi `null`. */
237
+ #place(container) {
238
+ if (container === this.#placedIn)
239
+ return;
240
+ const nodes = this.#embeddedViewRef.rootNodes;
241
+ this.#restoreContainerPosition?.();
242
+ this.#restoreContainerPosition = null;
243
+ this.#placedIn = container;
244
+ if (!container) {
245
+ for (const node of nodes)
246
+ this.#document.body.appendChild(node);
247
+ this.#layer?.remove();
248
+ this.#layer = null;
249
+ return;
250
+ }
251
+ this.#layer ??= this.#createLayer();
252
+ container.appendChild(this.#layer);
253
+ for (const node of nodes)
254
+ this.#layer.appendChild(node);
255
+ this.#restoreContainerPosition = this.#ensurePositioned(container);
256
+ }
257
+ #createLayer() {
258
+ const layer = this.#document.createElement('div');
259
+ layer.className = 'sd-side-drawer-layer';
260
+ // why: lớp bọc do code tạo, nằm ngoài view nên SCSS encapsulated không áp vào được — style inline.
261
+ // Phủ đúng vùng chứa và cắt phần panel đang trượt (không đẩy thanh cuộn ngang ra trang).
262
+ // `overflow: clip` chứ không phải `hidden`: CDK focus nút đóng ngay khi mở, lúc panel còn nằm ngoài
263
+ // lớp bọc; `hidden` vẫn cho cuộn bằng code nên trình duyệt cuộn lớp bọc để lộ nút — backdrop trượt
264
+ // từ trái sang và panel giật thay vì trượt vào từ phải. `hidden` đứng trước chỉ là fallback.
265
+ // pointer-events: none để khi drawer đóng, nội dung bên dưới vẫn bấm được. `container` cho phép
266
+ // SCSS co giãn theo bề rộng vùng chứa (@container sd-side-drawer) thay vì theo viewport.
267
+ layer.style.cssText =
268
+ 'position: absolute; inset: 0; overflow: hidden; overflow: clip; pointer-events: none;' +
269
+ ' z-index: var(--sd-side-drawer-contained-z-index, 100); container: sd-side-drawer / inline-size;';
270
+ return layer;
271
+ }
272
+ /** Vùng chứa `static` được đặt `relative` để làm khung định vị cho lớp bọc; trả về hàm hoàn tác. */
273
+ #ensurePositioned(container) {
274
+ const view = this.#document.defaultView;
275
+ if (!view || view.getComputedStyle(container).position !== 'static')
276
+ return null;
277
+ const previous = container.style.position;
278
+ container.style.position = 'relative';
279
+ return () => {
280
+ container.style.position = previous;
281
+ };
282
+ }
195
283
  startLoading = () => {
196
284
  this.#isLoadingSignal.set(true);
197
285
  this.#loadingService.stop(`#${this.id}`);
@@ -220,12 +308,12 @@ class SdSideDrawer {
220
308
  this.isHovered$ = merge(mouseEnter$, mouseLeave$).pipe(startWith(false), distinctUntilChanged(), takeUntil(this.#destroy$));
221
309
  }
222
310
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSideDrawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
223
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSideDrawer, isStandalone: true, selector: "sd-side-drawer", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, hideClose: { classPropertyName: "hideClose", publicName: "hideClose", isSignal: true, isRequired: false, transformFunction: null }, disableBackdropClose: { classPropertyName: "disableBackdropClose", publicName: "disableBackdropClose", isSignal: true, isRequired: false, transformFunction: null }, beforeClose: { classPropertyName: "beforeClose", publicName: "beforeClose", isSignal: true, isRequired: false, transformFunction: null }, drawerClass: { classPropertyName: "drawerClass", publicName: "drawerClass", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdClosed: "sdClosed", sdCloseError: "sdCloseError" }, viewQueries: [{ propertyName: "portal", first: true, predicate: CdkPortal, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template cdkPortal>\n @let _isOpened = isOpened();\n <div\n [id]=\"id\"\n class=\"sd-side-drawer\"\n [ngStyle]=\"{ width: width() }\"\n [ngClass]=\"drawerClass()\"\n [class.sd-side-drawer-active]=\"_isOpened\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\"\n [attr.data-loading]=\"dataLoading()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"title() || null\"\n (keydown.escape)=\"$event.stopPropagation(); disableBackdropClose() ? null : close()\"\n #drawerContainer>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-focus\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"sd-side-drawer-header\">\n <div class=\"sd-side-drawer-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-side-drawer-title\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-side-drawer-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <!-- why: aria-label=\"Close\" l\u00E0 chu\u1ED7i ti\u1EBFng Anh c\u1EE9ng trong m\u1ED9t th\u01B0 vi\u1EC7n \u0111\u00E3 c\u00F3 i18n. -->\n <button\n type=\"button\"\n class=\"sd-side-drawer-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-body\">\n <div class=\"sd-side-drawer-content\">\n <ng-content></ng-content>\n </div>\n </div>\n }\n <div class=\"sd-side-drawer-footer\">\n <div class=\"sd-side-drawer-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-side-drawer-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n </div>\n }\n </div>\n <!-- why: backdrop l\u00E0 l\u1EDBp ph\u1EE7 b\u1EAFt click thu\u1EA7n trang tr\u00ED, kh\u00F4ng c\u00F3 n\u1ED9i dung \u2014 nh\u01B0ng aria-hidden\n kh\u00F4ng ph\u1EA3i l\u00E0 c\u00E1ch khai b\u00E1o \u0111\u00FAng cho n\u00F3. `role=\"presentation\"` m\u1EDBi l\u00E0 t\u00EDn hi\u1EC7u ch\u00EDnh x\u00E1c\n (ph\u1EA7n t\u1EED n\u00E0y kh\u00F4ng mang ng\u1EEF ngh\u0129a), v\u00E0 quan tr\u1ECDng h\u01A1n: tr\u01B0\u1EDBc \u0111\u00E2y \"\u0111\u00F3ng b\u1EB1ng c\u00E1ch click ra\n ngo\u00E0i\" KH\u00D4NG c\u00F3 t\u01B0\u01A1ng \u0111\u01B0\u01A1ng b\u00E0n ph\u00EDm n\u00E0o c\u1EA3. Escape \u0111\u01B0\u1EE3c th\u00EAm \u1EDF drawer container. -->\n @if (_isOpened) {\n <div\n role=\"presentation\"\n class=\"sd-side-drawer-backdrop\"\n (click)=\"disableBackdropClose() ? null : close()\"\n (wheel)=\"preventScroll($event)\"\n (touchmove)=\"preventScroll($event)\"></div>\n }\n</ng-template>\n", styles: [".sd-side-drawer{--sd-side-drawer-inset: 10px;--sd-side-drawer-radius: var(--sd-overlay-radius, 8px);--sd-side-drawer-surface: var(--sd-surface, #fff);--sd-side-drawer-border: var(--sd-border, #dde0e5);--sd-side-drawer-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12);position:fixed;right:var(--sd-side-drawer-inset);top:var(--sd-side-drawer-inset);bottom:var(--sd-side-drawer-inset);max-width:calc(100vw - var(--sd-side-drawer-inset) - var(--sd-side-drawer-inset));background-color:var(--sd-side-drawer-surface);color:var(--sd-text);z-index:999;display:flex;flex-direction:column;opacity:0;visibility:hidden;transform:translate3d(calc(100% + var(--sd-side-drawer-inset)),0,0);transition:transform .18s ease,opacity .18s ease,visibility 0s linear .18s;pointer-events:none;overflow:hidden;border-radius:var(--sd-side-drawer-radius);box-shadow:var(--sd-side-drawer-shadow)}.sd-side-drawer-active{transition-delay:0s;opacity:1;visibility:visible;pointer-events:all;transform:translateZ(0)}.sd-side-drawer-header{min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-side-drawer-header-right{display:flex;align-items:center;gap:8px;flex:0 0 auto}.sd-side-drawer-title{font-size:20px;line-height:28px;font-weight:500;min-width:0}.sd-side-drawer-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-side-drawer-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-side-drawer-close-btn:active{background:var(--sd-border)}.sd-side-drawer-close-btn:focus{outline:none}.sd-side-drawer-close-btn:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}.sd-side-drawer-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-side-drawer-body{flex:1;position:relative}.sd-side-drawer-content{position:absolute;padding:0;inset:0;overflow:auto}.sd-side-drawer-footer{border-top:1px solid var(--sd-side-drawer-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-side-drawer-footer-left{flex:1 1 auto}.sd-side-drawer-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-side-drawer-footer-left:empty,.sd-side-drawer-footer-right:empty{display:none}.sd-side-drawer-footer:has(.sd-side-drawer-footer-left:empty):has(.sd-side-drawer-footer-right:empty){display:none}.sd-side-drawer-backdrop{background-color:#0006;border:0;outline:none!important;position:fixed;inset:0;z-index:99;width:100%;height:100%;transition:all .3s ease-in-out}.sd-side-drawer-focus{display:flex;flex-direction:column;flex:1;min-height:0}.sd-side-drawer-title{font-size:18px;line-height:25px;font-weight:600;overflow-wrap:anywhere}.sd-side-drawer-header,.sd-side-drawer-footer{flex-shrink:0;padding:12px 16px;background-color:var(--sd-white, #fff)}.sd-side-drawer-content{padding:12px 16px}@media(max-width:600px){.sd-side-drawer{--sd-side-drawer-inset: 8px}.sd-side-drawer-header{gap:8px}.sd-side-drawer-footer{padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;gap:8px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{flex-wrap:wrap}.sd-side-drawer-close-btn{width:44px;height:44px}::ng-deep .sd-side-drawer-footer button{min-height:44px}}@media(prefers-reduced-motion:reduce){.sd-side-drawer,.sd-side-drawer-backdrop,.sd-side-drawer-close-btn{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: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortal, selector: "[cdkPortal]", exportAs: ["cdkPortal"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
311
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdSideDrawer, isStandalone: true, selector: "sd-side-drawer", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, hideClose: { classPropertyName: "hideClose", publicName: "hideClose", isSignal: true, isRequired: false, transformFunction: null }, disableBackdropClose: { classPropertyName: "disableBackdropClose", publicName: "disableBackdropClose", isSignal: true, isRequired: false, transformFunction: null }, beforeClose: { classPropertyName: "beforeClose", publicName: "beforeClose", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, drawerClass: { classPropertyName: "drawerClass", publicName: "drawerClass", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdClosed: "sdClosed", sdCloseError: "sdCloseError" }, viewQueries: [{ propertyName: "portal", first: true, predicate: CdkPortal, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template cdkPortal>\n @let _isOpened = isOpened();\n @let _contained = contained();\n <div\n [id]=\"id\"\n class=\"sd-side-drawer\"\n [ngStyle]=\"{ width: width() }\"\n [ngClass]=\"drawerClass()\"\n [class.sd-side-drawer-active]=\"_isOpened\"\n [class.sd-side-drawer-contained]=\"_contained\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\"\n [attr.data-loading]=\"dataLoading()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"title() || null\"\n (keydown.escape)=\"$event.stopPropagation(); disableBackdropClose() ? null : close()\"\n #drawerContainer>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-focus\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"sd-side-drawer-header\">\n <div class=\"sd-side-drawer-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-side-drawer-title\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-side-drawer-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <!-- why: aria-label=\"Close\" l\u00E0 chu\u1ED7i ti\u1EBFng Anh c\u1EE9ng trong m\u1ED9t th\u01B0 vi\u1EC7n \u0111\u00E3 c\u00F3 i18n. -->\n <button\n type=\"button\"\n class=\"sd-side-drawer-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-body\">\n <div class=\"sd-side-drawer-content\">\n <ng-content></ng-content>\n </div>\n </div>\n }\n <div class=\"sd-side-drawer-footer\">\n <div class=\"sd-side-drawer-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-side-drawer-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n </div>\n }\n </div>\n <!-- why: backdrop l\u00E0 l\u1EDBp ph\u1EE7 b\u1EAFt click thu\u1EA7n trang tr\u00ED, kh\u00F4ng c\u00F3 n\u1ED9i dung \u2014 nh\u01B0ng aria-hidden\n kh\u00F4ng ph\u1EA3i l\u00E0 c\u00E1ch khai b\u00E1o \u0111\u00FAng cho n\u00F3. `role=\"presentation\"` m\u1EDBi l\u00E0 t\u00EDn hi\u1EC7u ch\u00EDnh x\u00E1c\n (ph\u1EA7n t\u1EED n\u00E0y kh\u00F4ng mang ng\u1EEF ngh\u0129a), v\u00E0 quan tr\u1ECDng h\u01A1n: tr\u01B0\u1EDBc \u0111\u00E2y \"\u0111\u00F3ng b\u1EB1ng c\u00E1ch click ra\n ngo\u00E0i\" KH\u00D4NG c\u00F3 t\u01B0\u01A1ng \u0111\u01B0\u01A1ng b\u00E0n ph\u00EDm n\u00E0o c\u1EA3. Escape \u0111\u01B0\u1EE3c th\u00EAm \u1EDF drawer container. -->\n @if (_isOpened) {\n <div\n role=\"presentation\"\n class=\"sd-side-drawer-backdrop\"\n [class.sd-side-drawer-backdrop-contained]=\"_contained\"\n (click)=\"disableBackdropClose() ? null : close()\"\n (wheel)=\"preventScroll($event)\"\n (touchmove)=\"preventScroll($event)\"></div>\n }\n</ng-template>\n", styles: [".sd-side-drawer{--sd-side-drawer-inset: 10px;--sd-side-drawer-radius: var(--sd-overlay-radius, 8px);--sd-side-drawer-surface: var(--sd-surface, #fff);--sd-side-drawer-border: var(--sd-border, #dde0e5);--sd-side-drawer-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12);position:fixed;right:var(--sd-side-drawer-inset);top:var(--sd-side-drawer-inset);bottom:var(--sd-side-drawer-inset);max-width:calc(100vw - var(--sd-side-drawer-inset) - var(--sd-side-drawer-inset));background-color:var(--sd-side-drawer-surface);color:var(--sd-text);z-index:999;display:flex;flex-direction:column;opacity:0;visibility:hidden;transform:translate3d(calc(100% + var(--sd-side-drawer-inset)),0,0);transition:transform .18s ease,opacity .18s ease,visibility 0s linear .18s;pointer-events:none;overflow:hidden;border-radius:var(--sd-side-drawer-radius);box-shadow:var(--sd-side-drawer-shadow)}.sd-side-drawer-active{transition-delay:0s;opacity:1;visibility:visible;pointer-events:all;transform:translateZ(0)}.sd-side-drawer-contained{position:absolute;max-width:calc(100% - var(--sd-side-drawer-inset) - var(--sd-side-drawer-inset))}.sd-side-drawer-header{min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-side-drawer-header-right{display:flex;align-items:center;gap:8px;flex:0 0 auto}.sd-side-drawer-title{font-size:20px;line-height:28px;font-weight:500;min-width:0}.sd-side-drawer-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-side-drawer-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-side-drawer-close-btn:active{background:var(--sd-border)}.sd-side-drawer-close-btn:focus{outline:none}.sd-side-drawer-close-btn:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}.sd-side-drawer-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-side-drawer-body{flex:1;position:relative}.sd-side-drawer-content{position:absolute;padding:0;inset:0;overflow:auto}.sd-side-drawer-footer{border-top:1px solid var(--sd-side-drawer-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-side-drawer-footer-left{flex:1 1 auto}.sd-side-drawer-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-side-drawer-footer-left:empty,.sd-side-drawer-footer-right:empty{display:none}.sd-side-drawer-footer:has(.sd-side-drawer-footer-left:empty):has(.sd-side-drawer-footer-right:empty){display:none}.sd-side-drawer-backdrop{background-color:#0006;border:0;outline:none!important;position:fixed;inset:0;z-index:99;width:100%;height:100%;transition:all .3s ease-in-out}.sd-side-drawer-backdrop-contained{position:absolute;pointer-events:auto}.sd-side-drawer-focus{display:flex;flex-direction:column;flex:1;min-height:0}.sd-side-drawer-title{font-size:18px;line-height:25px;font-weight:600;overflow-wrap:anywhere}.sd-side-drawer-header,.sd-side-drawer-footer{flex-shrink:0;padding:12px 16px;background-color:var(--sd-white, #fff)}.sd-side-drawer-content{padding:12px 16px}@media(max-width:600px){.sd-side-drawer{--sd-side-drawer-inset: 8px}.sd-side-drawer-header{gap:8px}.sd-side-drawer-footer{padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;gap:8px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{flex-wrap:wrap}.sd-side-drawer-close-btn{width:44px;height:44px}::ng-deep .sd-side-drawer-footer button{min-height:44px}}@container sd-side-drawer (max-width: 600px){.sd-side-drawer{--sd-side-drawer-inset: 8px}.sd-side-drawer-header{gap:8px}.sd-side-drawer-footer{padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;gap:8px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{flex-wrap:wrap}.sd-side-drawer-close-btn{width:44px;height:44px}::ng-deep .sd-side-drawer-footer button{min-height:44px}}@media(prefers-reduced-motion:reduce){.sd-side-drawer,.sd-side-drawer-backdrop,.sd-side-drawer-close-btn{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: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortal, selector: "[cdkPortal]", exportAs: ["cdkPortal"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
224
312
  }
225
313
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSideDrawer, decorators: [{
226
314
  type: Component,
227
- args: [{ selector: 'sd-side-drawer', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CdkTrapFocus, SdIcon, CommonModule, PortalModule, SdTranslatePipe], template: "<ng-template cdkPortal>\n @let _isOpened = isOpened();\n <div\n [id]=\"id\"\n class=\"sd-side-drawer\"\n [ngStyle]=\"{ width: width() }\"\n [ngClass]=\"drawerClass()\"\n [class.sd-side-drawer-active]=\"_isOpened\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\"\n [attr.data-loading]=\"dataLoading()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"title() || null\"\n (keydown.escape)=\"$event.stopPropagation(); disableBackdropClose() ? null : close()\"\n #drawerContainer>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-focus\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"sd-side-drawer-header\">\n <div class=\"sd-side-drawer-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-side-drawer-title\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-side-drawer-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <!-- why: aria-label=\"Close\" l\u00E0 chu\u1ED7i ti\u1EBFng Anh c\u1EE9ng trong m\u1ED9t th\u01B0 vi\u1EC7n \u0111\u00E3 c\u00F3 i18n. -->\n <button\n type=\"button\"\n class=\"sd-side-drawer-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-body\">\n <div class=\"sd-side-drawer-content\">\n <ng-content></ng-content>\n </div>\n </div>\n }\n <div class=\"sd-side-drawer-footer\">\n <div class=\"sd-side-drawer-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-side-drawer-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n </div>\n }\n </div>\n <!-- why: backdrop l\u00E0 l\u1EDBp ph\u1EE7 b\u1EAFt click thu\u1EA7n trang tr\u00ED, kh\u00F4ng c\u00F3 n\u1ED9i dung \u2014 nh\u01B0ng aria-hidden\n kh\u00F4ng ph\u1EA3i l\u00E0 c\u00E1ch khai b\u00E1o \u0111\u00FAng cho n\u00F3. `role=\"presentation\"` m\u1EDBi l\u00E0 t\u00EDn hi\u1EC7u ch\u00EDnh x\u00E1c\n (ph\u1EA7n t\u1EED n\u00E0y kh\u00F4ng mang ng\u1EEF ngh\u0129a), v\u00E0 quan tr\u1ECDng h\u01A1n: tr\u01B0\u1EDBc \u0111\u00E2y \"\u0111\u00F3ng b\u1EB1ng c\u00E1ch click ra\n ngo\u00E0i\" KH\u00D4NG c\u00F3 t\u01B0\u01A1ng \u0111\u01B0\u01A1ng b\u00E0n ph\u00EDm n\u00E0o c\u1EA3. Escape \u0111\u01B0\u1EE3c th\u00EAm \u1EDF drawer container. -->\n @if (_isOpened) {\n <div\n role=\"presentation\"\n class=\"sd-side-drawer-backdrop\"\n (click)=\"disableBackdropClose() ? null : close()\"\n (wheel)=\"preventScroll($event)\"\n (touchmove)=\"preventScroll($event)\"></div>\n }\n</ng-template>\n", styles: [".sd-side-drawer{--sd-side-drawer-inset: 10px;--sd-side-drawer-radius: var(--sd-overlay-radius, 8px);--sd-side-drawer-surface: var(--sd-surface, #fff);--sd-side-drawer-border: var(--sd-border, #dde0e5);--sd-side-drawer-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12);position:fixed;right:var(--sd-side-drawer-inset);top:var(--sd-side-drawer-inset);bottom:var(--sd-side-drawer-inset);max-width:calc(100vw - var(--sd-side-drawer-inset) - var(--sd-side-drawer-inset));background-color:var(--sd-side-drawer-surface);color:var(--sd-text);z-index:999;display:flex;flex-direction:column;opacity:0;visibility:hidden;transform:translate3d(calc(100% + var(--sd-side-drawer-inset)),0,0);transition:transform .18s ease,opacity .18s ease,visibility 0s linear .18s;pointer-events:none;overflow:hidden;border-radius:var(--sd-side-drawer-radius);box-shadow:var(--sd-side-drawer-shadow)}.sd-side-drawer-active{transition-delay:0s;opacity:1;visibility:visible;pointer-events:all;transform:translateZ(0)}.sd-side-drawer-header{min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-side-drawer-header-right{display:flex;align-items:center;gap:8px;flex:0 0 auto}.sd-side-drawer-title{font-size:20px;line-height:28px;font-weight:500;min-width:0}.sd-side-drawer-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-side-drawer-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-side-drawer-close-btn:active{background:var(--sd-border)}.sd-side-drawer-close-btn:focus{outline:none}.sd-side-drawer-close-btn:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}.sd-side-drawer-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-side-drawer-body{flex:1;position:relative}.sd-side-drawer-content{position:absolute;padding:0;inset:0;overflow:auto}.sd-side-drawer-footer{border-top:1px solid var(--sd-side-drawer-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-side-drawer-footer-left{flex:1 1 auto}.sd-side-drawer-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-side-drawer-footer-left:empty,.sd-side-drawer-footer-right:empty{display:none}.sd-side-drawer-footer:has(.sd-side-drawer-footer-left:empty):has(.sd-side-drawer-footer-right:empty){display:none}.sd-side-drawer-backdrop{background-color:#0006;border:0;outline:none!important;position:fixed;inset:0;z-index:99;width:100%;height:100%;transition:all .3s ease-in-out}.sd-side-drawer-focus{display:flex;flex-direction:column;flex:1;min-height:0}.sd-side-drawer-title{font-size:18px;line-height:25px;font-weight:600;overflow-wrap:anywhere}.sd-side-drawer-header,.sd-side-drawer-footer{flex-shrink:0;padding:12px 16px;background-color:var(--sd-white, #fff)}.sd-side-drawer-content{padding:12px 16px}@media(max-width:600px){.sd-side-drawer{--sd-side-drawer-inset: 8px}.sd-side-drawer-header{gap:8px}.sd-side-drawer-footer{padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;gap:8px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{flex-wrap:wrap}.sd-side-drawer-close-btn{width:44px;height:44px}::ng-deep .sd-side-drawer-footer button{min-height:44px}}@media(prefers-reduced-motion:reduce){.sd-side-drawer,.sd-side-drawer-backdrop,.sd-side-drawer-close-btn{transition:none}}\n"] }]
228
- }], ctorParameters: () => [], propDecorators: { portal: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkPortal), { isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], hideClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideClose", required: false }] }], disableBackdropClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBackdropClose", required: false }] }], beforeClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "beforeClose", required: false }] }], drawerClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "drawerClass", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], sdClosed: [{ type: i0.Output, args: ["sdClosed"] }], sdCloseError: [{ type: i0.Output, args: ["sdCloseError"] }] } });
315
+ args: [{ selector: 'sd-side-drawer', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CdkTrapFocus, SdIcon, CommonModule, PortalModule, SdTranslatePipe], template: "<ng-template cdkPortal>\n @let _isOpened = isOpened();\n @let _contained = contained();\n <div\n [id]=\"id\"\n class=\"sd-side-drawer\"\n [ngStyle]=\"{ width: width() }\"\n [ngClass]=\"drawerClass()\"\n [class.sd-side-drawer-active]=\"_isOpened\"\n [class.sd-side-drawer-contained]=\"_contained\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\"\n [attr.data-loading]=\"dataLoading()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"title() || null\"\n (keydown.escape)=\"$event.stopPropagation(); disableBackdropClose() ? null : close()\"\n #drawerContainer>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-focus\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"sd-side-drawer-header\">\n <div class=\"sd-side-drawer-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-side-drawer-title\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-side-drawer-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <!-- why: aria-label=\"Close\" l\u00E0 chu\u1ED7i ti\u1EBFng Anh c\u1EE9ng trong m\u1ED9t th\u01B0 vi\u1EC7n \u0111\u00E3 c\u00F3 i18n. -->\n <button\n type=\"button\"\n class=\"sd-side-drawer-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-body\">\n <div class=\"sd-side-drawer-content\">\n <ng-content></ng-content>\n </div>\n </div>\n }\n <div class=\"sd-side-drawer-footer\">\n <div class=\"sd-side-drawer-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-side-drawer-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n </div>\n }\n </div>\n <!-- why: backdrop l\u00E0 l\u1EDBp ph\u1EE7 b\u1EAFt click thu\u1EA7n trang tr\u00ED, kh\u00F4ng c\u00F3 n\u1ED9i dung \u2014 nh\u01B0ng aria-hidden\n kh\u00F4ng ph\u1EA3i l\u00E0 c\u00E1ch khai b\u00E1o \u0111\u00FAng cho n\u00F3. `role=\"presentation\"` m\u1EDBi l\u00E0 t\u00EDn hi\u1EC7u ch\u00EDnh x\u00E1c\n (ph\u1EA7n t\u1EED n\u00E0y kh\u00F4ng mang ng\u1EEF ngh\u0129a), v\u00E0 quan tr\u1ECDng h\u01A1n: tr\u01B0\u1EDBc \u0111\u00E2y \"\u0111\u00F3ng b\u1EB1ng c\u00E1ch click ra\n ngo\u00E0i\" KH\u00D4NG c\u00F3 t\u01B0\u01A1ng \u0111\u01B0\u01A1ng b\u00E0n ph\u00EDm n\u00E0o c\u1EA3. Escape \u0111\u01B0\u1EE3c th\u00EAm \u1EDF drawer container. -->\n @if (_isOpened) {\n <div\n role=\"presentation\"\n class=\"sd-side-drawer-backdrop\"\n [class.sd-side-drawer-backdrop-contained]=\"_contained\"\n (click)=\"disableBackdropClose() ? null : close()\"\n (wheel)=\"preventScroll($event)\"\n (touchmove)=\"preventScroll($event)\"></div>\n }\n</ng-template>\n", styles: [".sd-side-drawer{--sd-side-drawer-inset: 10px;--sd-side-drawer-radius: var(--sd-overlay-radius, 8px);--sd-side-drawer-surface: var(--sd-surface, #fff);--sd-side-drawer-border: var(--sd-border, #dde0e5);--sd-side-drawer-shadow: 0 6px 18px rgba(15, 23, 42, .18), 0 1px 3px rgba(15, 23, 42, .12);position:fixed;right:var(--sd-side-drawer-inset);top:var(--sd-side-drawer-inset);bottom:var(--sd-side-drawer-inset);max-width:calc(100vw - var(--sd-side-drawer-inset) - var(--sd-side-drawer-inset));background-color:var(--sd-side-drawer-surface);color:var(--sd-text);z-index:999;display:flex;flex-direction:column;opacity:0;visibility:hidden;transform:translate3d(calc(100% + var(--sd-side-drawer-inset)),0,0);transition:transform .18s ease,opacity .18s ease,visibility 0s linear .18s;pointer-events:none;overflow:hidden;border-radius:var(--sd-side-drawer-radius);box-shadow:var(--sd-side-drawer-shadow)}.sd-side-drawer-active{transition-delay:0s;opacity:1;visibility:visible;pointer-events:all;transform:translateZ(0)}.sd-side-drawer-contained{position:absolute;max-width:calc(100% - var(--sd-side-drawer-inset) - var(--sd-side-drawer-inset))}.sd-side-drawer-header{min-height:56px;display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-header-left{display:flex;align-items:center;flex:1 1 auto;min-width:0}.sd-side-drawer-header-right{display:flex;align-items:center;gap:8px;flex:0 0 auto}.sd-side-drawer-title{font-size:20px;line-height:28px;font-weight:500;min-width:0}.sd-side-drawer-close-btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--sd-text-secondary);line-height:0;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;transition:background-color 80ms ease,color 80ms ease}.sd-side-drawer-close-btn:hover{background:var(--sd-surface-muted);color:var(--sd-text)}.sd-side-drawer-close-btn:active{background:var(--sd-border)}.sd-side-drawer-close-btn:focus{outline:none}.sd-side-drawer-close-btn:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}.sd-side-drawer-close-btn sd-icon{display:block;width:20px;height:20px;font-size:20px;line-height:20px}.sd-side-drawer-body{flex:1;position:relative}.sd-side-drawer-content{position:absolute;padding:0;inset:0;overflow:auto}.sd-side-drawer-footer{border-top:1px solid var(--sd-side-drawer-border);display:flex;align-items:center;justify-content:space-between;gap:16px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{display:flex;align-items:center;gap:8px;min-width:0}.sd-side-drawer-footer-left{flex:1 1 auto}.sd-side-drawer-footer-right{flex:0 0 auto;margin-left:auto;justify-content:flex-end}.sd-side-drawer-footer-left:empty,.sd-side-drawer-footer-right:empty{display:none}.sd-side-drawer-footer:has(.sd-side-drawer-footer-left:empty):has(.sd-side-drawer-footer-right:empty){display:none}.sd-side-drawer-backdrop{background-color:#0006;border:0;outline:none!important;position:fixed;inset:0;z-index:99;width:100%;height:100%;transition:all .3s ease-in-out}.sd-side-drawer-backdrop-contained{position:absolute;pointer-events:auto}.sd-side-drawer-focus{display:flex;flex-direction:column;flex:1;min-height:0}.sd-side-drawer-title{font-size:18px;line-height:25px;font-weight:600;overflow-wrap:anywhere}.sd-side-drawer-header,.sd-side-drawer-footer{flex-shrink:0;padding:12px 16px;background-color:var(--sd-white, #fff)}.sd-side-drawer-content{padding:12px 16px}@media(max-width:600px){.sd-side-drawer{--sd-side-drawer-inset: 8px}.sd-side-drawer-header{gap:8px}.sd-side-drawer-footer{padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;gap:8px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{flex-wrap:wrap}.sd-side-drawer-close-btn{width:44px;height:44px}::ng-deep .sd-side-drawer-footer button{min-height:44px}}@container sd-side-drawer (max-width: 600px){.sd-side-drawer{--sd-side-drawer-inset: 8px}.sd-side-drawer-header{gap:8px}.sd-side-drawer-footer{padding:12px 16px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;gap:8px}.sd-side-drawer-footer-left,.sd-side-drawer-footer-right{flex-wrap:wrap}.sd-side-drawer-close-btn{width:44px;height:44px}::ng-deep .sd-side-drawer-footer button{min-height:44px}}@media(prefers-reduced-motion:reduce){.sd-side-drawer,.sd-side-drawer-backdrop,.sd-side-drawer-close-btn{transition:none}}\n"] }]
316
+ }], ctorParameters: () => [], propDecorators: { portal: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkPortal), { isSignal: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], hideClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideClose", required: false }] }], disableBackdropClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBackdropClose", required: false }] }], beforeClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "beforeClose", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], drawerClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "drawerClass", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], sdClosed: [{ type: i0.Output, args: ["sdClosed"] }], sdCloseError: [{ type: i0.Output, args: ["sdCloseError"] }] } });
229
317
 
230
318
  /**
231
319
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-components-side-drawer.mjs","sources":["../../../projects/sdcorejs-angular/components/side-drawer/src/body-scroll-lock.service.ts","../../../projects/sdcorejs-angular/components/side-drawer/src/side-drawer.component.ts","../../../projects/sdcorejs-angular/components/side-drawer/src/side-drawer.component.html","../../../projects/sdcorejs-angular/components/side-drawer/sdcorejs-angular-components-side-drawer.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n/**\n * Khoá scroll của `document.body` theo kiểu đếm tham chiếu (ref-count).\n *\n * why: mỗi drawer tự lưu/khôi phục `document.body.style.overflow` là KHÔNG stack-safe. Với hai\n * drawer chồng nhau: drawer ngoài lưu `''` rồi set `'hidden'`; drawer trong lưu `'hidden'` (giá trị\n * do drawer ngoài vừa ghi) rồi cũng set `'hidden'`. Đóng drawer ngoài trước → khôi phục `''` →\n * trang scroll lại được dù drawer trong vẫn mở; đóng drawer trong sau → khôi phục `'hidden'` →\n * trang KHOÁ SCROLL VĨNH VIỄN dù không còn drawer nào. Ref-count chỉ ghi DOM ở lần khoá đầu và\n * lần nhả cuối, nên thứ tự đóng không còn ảnh hưởng.\n */\ninterface SdBodyScrollLockState {\n count: number;\n previousOverflow: string | null;\n}\n\n/**\n * why: state nằm ở MODULE, khoá theo `Document`, KHÔNG nằm trong instance service.\n * `providedIn: 'root'` cho một instance mỗi *ứng dụng Angular*, không phải mỗi *document*. Hai app\n * bootstrap độc lập trên cùng một trang (micro-frontend, widget nhúng) sẽ có hai bộ đếm riêng, mỗi\n * bên chụp lại `overflow` mà bên kia vừa ghi — tái lập đúng bug khoá-scroll-vĩnh-viễn mà service\n * này sinh ra để sửa, chỉ dịch lên một tầng. Khoá theo `Document` thì mọi instance trong cùng\n * document dùng chung một bộ đếm, bất kể injector nào tạo ra chúng.\n */\nconst scrollLockStates = new WeakMap<Document, SdBodyScrollLockState>();\n\nconst stateFor = (doc: Document): SdBodyScrollLockState => {\n let state = scrollLockStates.get(doc);\n if (!state) {\n state = { count: 0, previousOverflow: null };\n scrollLockStates.set(doc, state);\n }\n return state;\n};\n\n@Injectable({ providedIn: 'root' })\nexport class SdBodyScrollLockService {\n readonly #document = inject(DOCUMENT);\n\n /** Số lượng khoá đang giữ trên document này — phục vụ chẩn đoán/test. */\n get count(): number {\n return stateFor(this.#document).count;\n }\n\n lock(): void {\n const state = stateFor(this.#document);\n const body = this.#document.body;\n if (!body) return;\n if (state.count === 0) {\n state.previousOverflow = body.style.overflow;\n body.style.overflow = 'hidden';\n }\n state.count++;\n }\n\n release(): void {\n const state = stateFor(this.#document);\n // Nhả nhiều hơn khoá (double close, destroy sau close) không được đẩy count xuống âm,\n // nếu không lần khoá kế tiếp sẽ không ghi DOM.\n if (state.count === 0) return;\n state.count--;\n if (state.count > 0) return;\n const body = this.#document.body;\n if (body) body.style.overflow = state.previousOverflow ?? '';\n state.previousOverflow = null;\n }\n}\n","import { CdkTrapFocus } from '@angular/cdk/a11y';\nimport { CdkPortal, DomPortalOutlet, PortalModule } from '@angular/cdk/portal';\nimport { CommonModule } from '@angular/common';\nimport {\n ApplicationRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EmbeddedViewRef,\n Injector,\n ViewContainerRef,\n afterNextRender,\n booleanAttribute,\n computed,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { SdLoadingService } from '@sdcorejs/angular/services';\nimport { Utilities } from '@sdcorejs/utils/fns';\nimport { fromEvent, merge, Observable, Subject } from 'rxjs';\nimport { map, takeUntil, startWith, distinctUntilChanged } from 'rxjs/operators';\nimport { SdIcon } from '@sdcorejs/angular/modules/icon';\nimport { SdTranslatePipe } from '@sdcorejs/angular/i18n';\nimport { SdBodyScrollLockService } from './body-scroll-lock.service';\n\nexport type SdSideDrawerBeforeClose = () => boolean | Promise<boolean>;\n\n@Component({\n selector: 'sd-side-drawer',\n templateUrl: './side-drawer.component.html',\n styleUrl: './side-drawer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CdkTrapFocus, SdIcon, CommonModule, PortalModule, SdTranslatePipe],\n})\nexport class SdSideDrawer {\n id = `I${Utilities.generateUuid()}`;\n\n portal = viewChild.required(CdkPortal);\n\n title = input<string>('');\n width = input<string>('480px');\n hideClose = input<boolean, boolean | ''>(false, { transform: booleanAttribute });\n disableBackdropClose = input<boolean, boolean | ''>(false, { transform: booleanAttribute });\n beforeClose = input<SdSideDrawerBeforeClose | undefined>(undefined);\n\n // Custom CSS class added to the root side-drawer container\n drawerClass = input<any>('');\n\n readonly autoIdInput = input<string | undefined | null>(undefined, { alias: 'autoId' });\n readonly autoId = computed(() => (this.autoIdInput() ? `components-side-drawer-${this.autoIdInput()}` : undefined));\n\n sdClosed = output<void>();\n sdCloseError = output<unknown>();\n\n #embeddedViewRef!: EmbeddedViewRef<any>;\n\n readonly #isOpenedSignal = signal(false);\n readonly #isLoadingSignal = signal(false);\n readonly isOpened = this.#isOpenedSignal.asReadonly();\n readonly isLoading = this.#isLoadingSignal.asReadonly();\n readonly dataOpened = computed(() => (this.#isOpenedSignal() ? 'true' : 'false'));\n readonly dataLoading = computed(() => (this.#isLoadingSignal() ? 'true' : 'false'));\n\n isHovered$!: Observable<boolean>;\n #destroy$ = new Subject<void>();\n // Instance này có đang giữ 1 khoá scroll hay không — giữ cho lock/release luôn cân bằng\n // dù open()/close() bị gọi lặp.\n #holdsScrollLock = false;\n #closeRequest?: Promise<boolean>;\n\n #viewContainerRef = inject(ViewContainerRef);\n #ar = inject(ApplicationRef);\n #injector = inject(Injector);\n #ref = inject(ChangeDetectorRef);\n #loadingService = inject(SdLoadingService);\n #destroyRef = inject(DestroyRef);\n #scrollLock = inject(SdBodyScrollLockService);\n\n constructor() {\n // Thay thế ngAfterViewInit, tự động chạy nội dung này khi DOM sẵn sàng để render\n afterNextRender(() => {\n // 1. Gắn portal vào body và lưu lại EmbeddedViewRef\n const outlet = new DomPortalOutlet(document.body, this.#ar, this.#injector);\n this.#embeddedViewRef = outlet.attachTemplatePortal(this.portal());\n\n // 2. Setup sự kiện hover ngay sau khi DOM thật đã được in ra\n this.#setupHoverSubscription();\n });\n\n // Thay thế ngOnDestroy bằng logic destroy trực tiếp\n this.#destroyRef.onDestroy(() => {\n this.#destroy$.next();\n this.#destroy$.complete();\n\n if (this.#embeddedViewRef) {\n this.#embeddedViewRef.destroy();\n }\n\n // Destroy khi đang mở cũng phải nhả khoá, nếu không ref-count kẹt > 0 và trang khoá scroll mãi.\n this.#releaseScrollLock();\n });\n }\n\n open = () => {\n this.#ref.markForCheck();\n this.#isOpenedSignal.set(true);\n\n // Chặn scroll ở document body qua khoá ref-count dùng chung (stack-safe với drawer lồng nhau)\n this.#acquireScrollLock();\n };\n\n close = () => {\n if (this.beforeClose()) {\n void this.requestClose();\n return;\n }\n this.forceClose();\n };\n\n requestClose = (): Promise<boolean> => {\n const guard = this.beforeClose();\n if (!guard) {\n this.forceClose();\n return Promise.resolve(true);\n }\n if (this.#closeRequest) return this.#closeRequest;\n\n const request = Promise.resolve()\n .then(() => guard())\n .then(canClose => {\n if (!canClose) return false;\n this.forceClose();\n return true;\n })\n .catch((error: unknown) => {\n this.sdCloseError.emit(error);\n return false;\n });\n\n this.#closeRequest = request;\n void request.finally(() => {\n if (this.#closeRequest === request) this.#closeRequest = undefined;\n });\n return request;\n };\n\n forceClose = () => {\n this.#ref.markForCheck();\n this.#isOpenedSignal.set(false);\n this.sdClosed.emit();\n this.stopLoading();\n\n // Khôi phục lại scroll ở document body (chỉ thật sự khôi phục khi drawer cuối cùng nhả khoá)\n this.#releaseScrollLock();\n };\n\n #acquireScrollLock(): void {\n if (this.#holdsScrollLock) return;\n this.#holdsScrollLock = true;\n this.#scrollLock.lock();\n }\n\n #releaseScrollLock(): void {\n if (!this.#holdsScrollLock) return;\n this.#holdsScrollLock = false;\n this.#scrollLock.release();\n }\n\n startLoading = () => {\n this.#isLoadingSignal.set(true);\n this.#loadingService.stop(`#${this.id}`);\n this.#loadingService.start(`#${this.id}`);\n };\n\n stopLoading = () => {\n this.#isLoadingSignal.set(false);\n this.#loadingService.stop(`#${this.id}`);\n };\n\n preventScroll = (event: Event) => {\n event.preventDefault();\n };\n\n #setupHoverSubscription(): void {\n if (!this.#embeddedViewRef) return;\n\n // 3. Lấy DOM element trực tiếp từ rootNodes của EmbeddedViewRef\n const rootNodes = this.#embeddedViewRef.rootNodes;\n const element = rootNodes.find(\n node => node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).classList?.contains('sd-side-drawer')\n );\n\n if (!element) {\n console.warn('SdSideDrawer: Cannot find sd-side-drawer element to attach hover event');\n return;\n }\n\n // 4. Gắn event listeners trực tiếp lên element thật\n const mouseEnter$ = fromEvent(element, 'mouseenter').pipe(map(() => true));\n const mouseLeave$ = fromEvent(element, 'mouseleave').pipe(map(() => false));\n\n this.isHovered$ = merge(mouseEnter$, mouseLeave$).pipe(startWith(false), distinctUntilChanged(), takeUntil(this.#destroy$));\n }\n}\n","<ng-template cdkPortal>\n @let _isOpened = isOpened();\n <div\n [id]=\"id\"\n class=\"sd-side-drawer\"\n [ngStyle]=\"{ width: width() }\"\n [ngClass]=\"drawerClass()\"\n [class.sd-side-drawer-active]=\"_isOpened\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\"\n [attr.data-loading]=\"dataLoading()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"title() || null\"\n (keydown.escape)=\"$event.stopPropagation(); disableBackdropClose() ? null : close()\"\n #drawerContainer>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-focus\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"sd-side-drawer-header\">\n <div class=\"sd-side-drawer-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-side-drawer-title\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-side-drawer-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <!-- why: aria-label=\"Close\" là chuỗi tiếng Anh cứng trong một thư viện đã có i18n. -->\n <button\n type=\"button\"\n class=\"sd-side-drawer-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-body\">\n <div class=\"sd-side-drawer-content\">\n <ng-content></ng-content>\n </div>\n </div>\n }\n <div class=\"sd-side-drawer-footer\">\n <div class=\"sd-side-drawer-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-side-drawer-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n </div>\n }\n </div>\n <!-- why: backdrop là lớp phủ bắt click thuần trang trí, không có nội dung — nhưng aria-hidden\n không phải là cách khai báo đúng cho nó. `role=\"presentation\"` mới là tín hiệu chính xác\n (phần tử này không mang ngữ nghĩa), và quan trọng hơn: trước đây \"đóng bằng cách click ra\n ngoài\" KHÔNG có tương đương bàn phím nào cả. Escape được thêm ở drawer container. -->\n @if (_isOpened) {\n <div\n role=\"presentation\"\n class=\"sd-side-drawer-backdrop\"\n (click)=\"disableBackdropClose() ? null : close()\"\n (wheel)=\"preventScroll($event)\"\n (touchmove)=\"preventScroll($event)\"></div>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAkBA;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAmC;AAEvE,MAAM,QAAQ,GAAG,CAAC,GAAa,KAA2B;IACxD,IAAI,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;IACrC,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE;AAC5C,QAAA,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;IAClC;AACA,IAAA,OAAO,KAAK;AACd,CAAC;MAGY,uBAAuB,CAAA;AACzB,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAGrC,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK;IACvC;IAEA,IAAI,GAAA;QACF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AACtC,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI;AAChC,QAAA,IAAI,CAAC,IAAI;YAAE;AACX,QAAA,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC,EAAE;YACrB,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ;AAC5C,YAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ;QAChC;QACA,KAAK,CAAC,KAAK,EAAE;IACf;IAEA,OAAO,GAAA;QACL,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;;;AAGtC,QAAA,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC;YAAE;QACvB,KAAK,CAAC,KAAK,EAA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AAA,EAAA,sBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,aAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,QAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,UAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE1CvC;;AAEG;;"}
1
+ {"version":3,"file":"sdcorejs-angular-components-side-drawer.mjs","sources":["../../../projects/sdcorejs-angular/components/side-drawer/src/body-scroll-lock.service.ts","../../../projects/sdcorejs-angular/components/side-drawer/src/side-drawer.component.ts","../../../projects/sdcorejs-angular/components/side-drawer/src/side-drawer.component.html","../../../projects/sdcorejs-angular/components/side-drawer/sdcorejs-angular-components-side-drawer.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n/**\n * Khoá scroll của `document.body` theo kiểu đếm tham chiếu (ref-count).\n *\n * why: mỗi drawer tự lưu/khôi phục `document.body.style.overflow` là KHÔNG stack-safe. Với hai\n * drawer chồng nhau: drawer ngoài lưu `''` rồi set `'hidden'`; drawer trong lưu `'hidden'` (giá trị\n * do drawer ngoài vừa ghi) rồi cũng set `'hidden'`. Đóng drawer ngoài trước → khôi phục `''` →\n * trang scroll lại được dù drawer trong vẫn mở; đóng drawer trong sau → khôi phục `'hidden'` →\n * trang KHOÁ SCROLL VĨNH VIỄN dù không còn drawer nào. Ref-count chỉ ghi DOM ở lần khoá đầu và\n * lần nhả cuối, nên thứ tự đóng không còn ảnh hưởng.\n */\ninterface SdBodyScrollLockState {\n count: number;\n previousOverflow: string | null;\n}\n\n/**\n * why: state nằm ở MODULE, khoá theo `Document`, KHÔNG nằm trong instance service.\n * `providedIn: 'root'` cho một instance mỗi *ứng dụng Angular*, không phải mỗi *document*. Hai app\n * bootstrap độc lập trên cùng một trang (micro-frontend, widget nhúng) sẽ có hai bộ đếm riêng, mỗi\n * bên chụp lại `overflow` mà bên kia vừa ghi — tái lập đúng bug khoá-scroll-vĩnh-viễn mà service\n * này sinh ra để sửa, chỉ dịch lên một tầng. Khoá theo `Document` thì mọi instance trong cùng\n * document dùng chung một bộ đếm, bất kể injector nào tạo ra chúng.\n */\nconst scrollLockStates = new WeakMap<Document, SdBodyScrollLockState>();\n\nconst stateFor = (doc: Document): SdBodyScrollLockState => {\n let state = scrollLockStates.get(doc);\n if (!state) {\n state = { count: 0, previousOverflow: null };\n scrollLockStates.set(doc, state);\n }\n return state;\n};\n\n@Injectable({ providedIn: 'root' })\nexport class SdBodyScrollLockService {\n readonly #document = inject(DOCUMENT);\n\n /** Số lượng khoá đang giữ trên document này — phục vụ chẩn đoán/test. */\n get count(): number {\n return stateFor(this.#document).count;\n }\n\n lock(): void {\n const state = stateFor(this.#document);\n const body = this.#document.body;\n if (!body) return;\n if (state.count === 0) {\n state.previousOverflow = body.style.overflow;\n body.style.overflow = 'hidden';\n }\n state.count++;\n }\n\n release(): void {\n const state = stateFor(this.#document);\n // Nhả nhiều hơn khoá (double close, destroy sau close) không được đẩy count xuống âm,\n // nếu không lần khoá kế tiếp sẽ không ghi DOM.\n if (state.count === 0) return;\n state.count--;\n if (state.count > 0) return;\n const body = this.#document.body;\n if (body) body.style.overflow = state.previousOverflow ?? '';\n state.previousOverflow = null;\n }\n}\n","import { CdkTrapFocus } from '@angular/cdk/a11y';\nimport { CdkPortal, DomPortalOutlet, PortalModule } from '@angular/cdk/portal';\nimport { CommonModule, DOCUMENT } from '@angular/common';\nimport {\n ApplicationRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n ElementRef,\n EmbeddedViewRef,\n Injector,\n ViewContainerRef,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { SdLoadingService } from '@sdcorejs/angular/services';\nimport { Utilities } from '@sdcorejs/utils/fns';\nimport { fromEvent, merge, Observable, Subject } from 'rxjs';\nimport { map, takeUntil, startWith, distinctUntilChanged } from 'rxjs/operators';\nimport { SdIcon } from '@sdcorejs/angular/modules/icon';\nimport { SdTranslatePipe } from '@sdcorejs/angular/i18n';\nimport { SdBodyScrollLockService } from './body-scroll-lock.service';\n\nexport type SdSideDrawerBeforeClose = () => boolean | Promise<boolean>;\n\n/** Element a drawer opens inside — see `SdSideDrawer.container`. */\nexport type SdSideDrawerContainer = HTMLElement | ElementRef<HTMLElement>;\n\n@Component({\n selector: 'sd-side-drawer',\n templateUrl: './side-drawer.component.html',\n styleUrl: './side-drawer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CdkTrapFocus, SdIcon, CommonModule, PortalModule, SdTranslatePipe],\n})\nexport class SdSideDrawer {\n id = `I${Utilities.generateUuid()}`;\n\n portal = viewChild.required(CdkPortal);\n\n title = input<string>('');\n width = input<string>('480px');\n hideClose = input<boolean, boolean | ''>(false, { transform: booleanAttribute });\n disableBackdropClose = input<boolean, boolean | ''>(false, { transform: booleanAttribute });\n beforeClose = input<SdSideDrawerBeforeClose | undefined>(undefined);\n\n /**\n * Element the drawer opens inside, for example a template reference: `[container]=\"area\"`.\n * Panel and backdrop then cover only that element and page scroll stays unlocked; a statically\n * positioned container becomes `position: relative` while the drawer lives in it.\n * `null` (default): the drawer covers the viewport.\n */\n container = input<SdSideDrawerContainer | null | undefined>(null);\n\n // Custom CSS class added to the root side-drawer container\n drawerClass = input<any>('');\n\n readonly autoIdInput = input<string | undefined | null>(undefined, { alias: 'autoId' });\n readonly autoId = computed(() => (this.autoIdInput() ? `components-side-drawer-${this.autoIdInput()}` : undefined));\n\n sdClosed = output<void>();\n sdCloseError = output<unknown>();\n\n #embeddedViewRef!: EmbeddedViewRef<any>;\n\n readonly #isOpenedSignal = signal(false);\n readonly #isLoadingSignal = signal(false);\n readonly isOpened = this.#isOpenedSignal.asReadonly();\n readonly isLoading = this.#isLoadingSignal.asReadonly();\n readonly dataOpened = computed(() => (this.#isOpenedSignal() ? 'true' : 'false'));\n readonly dataLoading = computed(() => (this.#isLoadingSignal() ? 'true' : 'false'));\n\n readonly #containerElement = computed(() => {\n const container = this.container();\n return container instanceof ElementRef ? container.nativeElement : (container ?? null);\n });\n protected readonly contained = computed(() => this.#containerElement() !== null);\n\n isHovered$!: Observable<boolean>;\n #destroy$ = new Subject<void>();\n // Instance này có đang giữ 1 khoá scroll hay không — giữ cho lock/release luôn cân bằng\n // dù open()/close() bị gọi lặp.\n #holdsScrollLock = false;\n #closeRequest?: Promise<boolean>;\n // Lớp bọc do drawer tự tạo trong [container]; null khi drawer nằm ở body.\n #layer: HTMLElement | null = null;\n #placedIn: HTMLElement | null = null;\n #restoreContainerPosition: (() => void) | null = null;\n\n #viewContainerRef = inject(ViewContainerRef);\n #ar = inject(ApplicationRef);\n #injector = inject(Injector);\n #ref = inject(ChangeDetectorRef);\n #loadingService = inject(SdLoadingService);\n #destroyRef = inject(DestroyRef);\n #scrollLock = inject(SdBodyScrollLockService);\n #document = inject(DOCUMENT);\n\n constructor() {\n // Thay thế ngAfterViewInit, tự động chạy nội dung này khi DOM sẵn sàng để render\n afterNextRender(() => {\n // 1. Gắn portal vào body và lưu lại EmbeddedViewRef\n const outlet = new DomPortalOutlet(document.body, this.#ar, this.#injector);\n this.#embeddedViewRef = outlet.attachTemplatePortal(this.portal());\n\n // 2. Có [container] thì chuyển DOM của drawer vào vùng chứa đó\n this.#place(this.#containerElement());\n\n // 3. Setup sự kiện hover ngay sau khi DOM thật đã được in ra\n this.#setupHoverSubscription();\n });\n\n // [container] đổi sau khi portal đã gắn: chuyển DOM sang vùng mới và cân lại khoá scroll body.\n effect(() => {\n const container = this.#containerElement();\n untracked(() => {\n if (this.#embeddedViewRef) this.#place(container);\n this.#syncScrollLock();\n });\n });\n\n // Thay thế ngOnDestroy bằng logic destroy trực tiếp\n this.#destroyRef.onDestroy(() => {\n this.#destroy$.next();\n this.#destroy$.complete();\n\n if (this.#embeddedViewRef) {\n this.#embeddedViewRef.destroy();\n }\n\n // Drawer trong [container]: gỡ lớp bọc và trả lại position ban đầu của vùng chứa.\n this.#layer?.remove();\n this.#restoreContainerPosition?.();\n\n // Destroy khi đang mở cũng phải nhả khoá, nếu không ref-count kẹt > 0 và trang khoá scroll mãi.\n this.#releaseScrollLock();\n });\n }\n\n open = () => {\n this.#ref.markForCheck();\n this.#isOpenedSignal.set(true);\n\n // Chặn scroll ở document body qua khoá ref-count dùng chung (stack-safe với drawer lồng nhau).\n // Drawer mở trong [container] không khoá: phần còn lại của trang vẫn dùng được.\n this.#syncScrollLock();\n };\n\n close = () => {\n if (this.beforeClose()) {\n void this.requestClose();\n return;\n }\n this.forceClose();\n };\n\n requestClose = (): Promise<boolean> => {\n const guard = this.beforeClose();\n if (!guard) {\n this.forceClose();\n return Promise.resolve(true);\n }\n if (this.#closeRequest) return this.#closeRequest;\n\n const request = Promise.resolve()\n .then(() => guard())\n .then(canClose => {\n if (!canClose) return false;\n this.forceClose();\n return true;\n })\n .catch((error: unknown) => {\n this.sdCloseError.emit(error);\n return false;\n });\n\n this.#closeRequest = request;\n void request.finally(() => {\n if (this.#closeRequest === request) this.#closeRequest = undefined;\n });\n return request;\n };\n\n forceClose = () => {\n this.#ref.markForCheck();\n this.#isOpenedSignal.set(false);\n this.sdClosed.emit();\n this.stopLoading();\n\n // Khôi phục lại scroll ở document body (chỉ thật sự khôi phục khi drawer cuối cùng nhả khoá)\n this.#releaseScrollLock();\n };\n\n #syncScrollLock(): void {\n if (this.#isOpenedSignal() && !this.contained()) this.#acquireScrollLock();\n else this.#releaseScrollLock();\n }\n\n #acquireScrollLock(): void {\n if (this.#holdsScrollLock) return;\n this.#holdsScrollLock = true;\n this.#scrollLock.lock();\n }\n\n #releaseScrollLock(): void {\n if (!this.#holdsScrollLock) return;\n this.#holdsScrollLock = false;\n this.#scrollLock.release();\n }\n\n /** Chuyển DOM của drawer vào `container`, hoặc về lại `<body>` khi `null`. */\n #place(container: HTMLElement | null): void {\n if (container === this.#placedIn) return;\n const nodes = this.#embeddedViewRef.rootNodes as Node[];\n this.#restoreContainerPosition?.();\n this.#restoreContainerPosition = null;\n this.#placedIn = container;\n if (!container) {\n for (const node of nodes) this.#document.body.appendChild(node);\n this.#layer?.remove();\n this.#layer = null;\n return;\n }\n this.#layer ??= this.#createLayer();\n container.appendChild(this.#layer);\n for (const node of nodes) this.#layer.appendChild(node);\n this.#restoreContainerPosition = this.#ensurePositioned(container);\n }\n\n #createLayer(): HTMLElement {\n const layer = this.#document.createElement('div');\n layer.className = 'sd-side-drawer-layer';\n // why: lớp bọc do code tạo, nằm ngoài view nên SCSS encapsulated không áp vào được — style inline.\n // Phủ đúng vùng chứa và cắt phần panel đang trượt (không đẩy thanh cuộn ngang ra trang).\n // `overflow: clip` chứ không phải `hidden`: CDK focus nút đóng ngay khi mở, lúc panel còn nằm ngoài\n // lớp bọc; `hidden` vẫn cho cuộn bằng code nên trình duyệt cuộn lớp bọc để lộ nút — backdrop trượt\n // từ trái sang và panel giật thay vì trượt vào từ phải. `hidden` đứng trước chỉ là fallback.\n // pointer-events: none để khi drawer đóng, nội dung bên dưới vẫn bấm được. `container` cho phép\n // SCSS co giãn theo bề rộng vùng chứa (@container sd-side-drawer) thay vì theo viewport.\n layer.style.cssText =\n 'position: absolute; inset: 0; overflow: hidden; overflow: clip; pointer-events: none;' +\n ' z-index: var(--sd-side-drawer-contained-z-index, 100); container: sd-side-drawer / inline-size;';\n return layer;\n }\n\n /** Vùng chứa `static` được đặt `relative` để làm khung định vị cho lớp bọc; trả về hàm hoàn tác. */\n #ensurePositioned(container: HTMLElement): (() => void) | null {\n const view = this.#document.defaultView;\n if (!view || view.getComputedStyle(container).position !== 'static') return null;\n const previous = container.style.position;\n container.style.position = 'relative';\n return () => {\n container.style.position = previous;\n };\n }\n\n startLoading = () => {\n this.#isLoadingSignal.set(true);\n this.#loadingService.stop(`#${this.id}`);\n this.#loadingService.start(`#${this.id}`);\n };\n\n stopLoading = () => {\n this.#isLoadingSignal.set(false);\n this.#loadingService.stop(`#${this.id}`);\n };\n\n preventScroll = (event: Event) => {\n event.preventDefault();\n };\n\n #setupHoverSubscription(): void {\n if (!this.#embeddedViewRef) return;\n\n // 3. Lấy DOM element trực tiếp từ rootNodes của EmbeddedViewRef\n const rootNodes = this.#embeddedViewRef.rootNodes;\n const element = rootNodes.find(\n node => node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).classList?.contains('sd-side-drawer')\n );\n\n if (!element) {\n console.warn('SdSideDrawer: Cannot find sd-side-drawer element to attach hover event');\n return;\n }\n\n // 4. Gắn event listeners trực tiếp lên element thật\n const mouseEnter$ = fromEvent(element, 'mouseenter').pipe(map(() => true));\n const mouseLeave$ = fromEvent(element, 'mouseleave').pipe(map(() => false));\n\n this.isHovered$ = merge(mouseEnter$, mouseLeave$).pipe(startWith(false), distinctUntilChanged(), takeUntil(this.#destroy$));\n }\n}\n","<ng-template cdkPortal>\n @let _isOpened = isOpened();\n @let _contained = contained();\n <div\n [id]=\"id\"\n class=\"sd-side-drawer\"\n [ngStyle]=\"{ width: width() }\"\n [ngClass]=\"drawerClass()\"\n [class.sd-side-drawer-active]=\"_isOpened\"\n [class.sd-side-drawer-contained]=\"_contained\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-opened]=\"dataOpened()\"\n [attr.data-loading]=\"dataLoading()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"title() || null\"\n (keydown.escape)=\"$event.stopPropagation(); disableBackdropClose() ? null : close()\"\n #drawerContainer>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-focus\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <div class=\"sd-side-drawer-header\">\n <div class=\"sd-side-drawer-header-left\">\n <ng-content select=\"[sdHeaderLeft]\">\n <div class=\"sd-side-drawer-title\">{{ title() }}</div>\n </ng-content>\n </div>\n <div class=\"sd-side-drawer-header-right\">\n <ng-content select=\"[sdHeaderRight]\"></ng-content>\n @if (!hideClose()) {\n <!-- why: aria-label=\"Close\" là chuỗi tiếng Anh cứng trong một thư viện đã có i18n. -->\n <button\n type=\"button\"\n class=\"sd-side-drawer-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"'core.common.close' | sdTranslate\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n </div>\n </div>\n @if (_isOpened) {\n <div class=\"sd-side-drawer-body\">\n <div class=\"sd-side-drawer-content\">\n <ng-content></ng-content>\n </div>\n </div>\n }\n <div class=\"sd-side-drawer-footer\">\n <div class=\"sd-side-drawer-footer-left\"><ng-content select=\"[sdFooterLeft]\"></ng-content></div>\n <div class=\"sd-side-drawer-footer-right\"><ng-content select=\"[sdFooterRight]\"></ng-content></div>\n </div>\n </div>\n }\n </div>\n <!-- why: backdrop là lớp phủ bắt click thuần trang trí, không có nội dung — nhưng aria-hidden\n không phải là cách khai báo đúng cho nó. `role=\"presentation\"` mới là tín hiệu chính xác\n (phần tử này không mang ngữ nghĩa), và quan trọng hơn: trước đây \"đóng bằng cách click ra\n ngoài\" KHÔNG có tương đương bàn phím nào cả. Escape được thêm ở drawer container. -->\n @if (_isOpened) {\n <div\n role=\"presentation\"\n class=\"sd-side-drawer-backdrop\"\n [class.sd-side-drawer-backdrop-contained]=\"_contained\"\n (click)=\"disableBackdropClose() ? null : close()\"\n (wheel)=\"preventScroll($event)\"\n (touchmove)=\"preventScroll($event)\"></div>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAkBA;;;;;;;AAOG;AACH,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAmC;AAEvE,MAAM,QAAQ,GAAG,CAAC,GAAa,KAA2B;IACxD,IAAI,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;IACrC,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE;AAC5C,QAAA,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;IAClC;AACA,IAAA,OAAO,KAAK;AACd,CAAC;MAGY,uBAAuB,CAAA;AACzB,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAGrC,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK;IACvC;IAEA,IAAI,GAAA;QACF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AACtC,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI;AAChC,QAAA,IAAI,CAAC,IAAI;YAAE;AACX,QAAA,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC,EAAE;YACrB,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ;AAC5C,YAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,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A,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,UAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEhDvC;;AAEG;;"}
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, inject, Pipe, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, viewChild, input, ElementRef, HostListener, booleanAttribute, signal, Injector, afterNextRender, NgModuleFactory, createNgModule } from '@angular/core';
2
+ import { InjectionToken, Injectable, inject, Pipe, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, viewChild, input, ElementRef, HostListener, booleanAttribute, signal, ErrorHandler, Injector, afterNextRender, NgModuleFactory, createNgModule } from '@angular/core';
3
3
  import { Router, RoutesRecognized, NavigationEnd, NavigationSkipped, NavigationCancel, NavigationError, NavigationSkippedCode, RouterOutlet, ActivatedRoute } from '@angular/router';
4
4
  import * as i1$1 from '@angular/common';
5
5
  import { CommonModule } from '@angular/common';
6
6
  import { MatTooltipModule } from '@angular/material/tooltip';
7
- import { BehaviorSubject, Subscription, from, isObservable, lastValueFrom, Subject } from 'rxjs';
8
- import { debounceTime, startWith, filter, map, concatMap } from 'rxjs/operators';
7
+ import { BehaviorSubject, Subscription, defer, EMPTY, isObservable, lastValueFrom, Subject } from 'rxjs';
8
+ import { debounceTime, startWith, filter, map, concatMap, catchError } from 'rxjs/operators';
9
9
  import { SdNotifyService } from '@sdcorejs/angular/services/notify';
10
10
  import { SdTranslatePipe, I18nService } from '@sdcorejs/angular/i18n';
11
11
  import { Utilities } from '@sdcorejs/utils/fns';
@@ -323,6 +323,7 @@ class SdTabRouterOutletComponent {
323
323
  tabs = signal([], /* @ts-ignore */
324
324
  ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
325
325
  #router = inject(Router);
326
+ #errorHandler = inject(ErrorHandler);
326
327
  #injector = inject(Injector);
327
328
  #tabRouterService = inject(SdTabRouterService);
328
329
  #sdNotifyService = inject(SdNotifyService);
@@ -360,7 +361,12 @@ class SdTabRouterOutletComponent {
360
361
  })),
361
362
  // Serialize: #handleEvent async (await getBestInjector). 2 nav liên tiếp
362
363
  // không await xen kẽ → tránh race đọc this.tabs() = [] khi tab đầu chưa kịp set.
363
- concatMap(context => from(this.#handleEvent(context))))
364
+ concatMap(context => defer(() => this.#handleEvent(context)).pipe(
365
+ // why: Cô lập lỗi từng lần chuyển tab để router.events tiếp tục nhận menu sau đó.
366
+ catchError(error => {
367
+ this.#errorHandler.handleError(error);
368
+ return EMPTY;
369
+ }))))
364
370
  .subscribe());
365
371
  this.#subscription.add(this.#tabRouterService.actions.subscribe((event) => {
366
372
  if (this.disabled())