@sd-angular/core 19.0.0-beta.73 → 19.0.0-beta.74
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/components/anchor-v2/src/components/anchor-v2/anchor-v2.component.d.ts +12 -18
- package/components/anchor-v2/src/components/anchor-vertical-v2/anchor-vertical-list-v2.component.d.ts +9 -10
- package/components/chart/src/bar-chart.component.d.ts +5 -6
- package/components/chart/src/doughnut-chart.component.d.ts +2 -2
- package/components/chart/src/line-chart.component.d.ts +4 -2
- package/components/chart/src/pie-chart.component.d.ts +2 -2
- package/components/table/index.d.ts +1 -0
- package/components/table/src/components/column-title/column-title.component.d.ts +10 -0
- package/components/table/src/components/desktop-cell/desktop-cell.component.d.ts +10 -15
- package/components/table/src/components/desktop-cell/view/view.component.d.ts +24 -0
- package/components/table/src/components/index.d.ts +1 -0
- package/components/table/src/directives/index.d.ts +2 -0
- package/components/table/src/directives/sd-table-cell-def.directive.d.ts +2 -3
- package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +2 -3
- package/components/table/src/directives/sd-table-expand-def.directive.d.ts +0 -1
- package/components/table/src/directives/sd-table-filter-def.directive.d.ts +4 -6
- package/components/table/src/directives/sd-table-footer-def.directive.d.ts +2 -3
- package/components/table/src/directives/sd-table-title-def.directive.d.ts +8 -0
- package/components/table/src/models/table-column.model.d.ts +15 -10
- package/components/table/src/models/table-option-config.model.d.ts +3 -5
- package/components/table/src/table.component.d.ts +4 -1
- package/fesm2022/sd-angular-core-components-anchor-v2.mjs +67 -142
- package/fesm2022/sd-angular-core-components-anchor-v2.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-chart.mjs +57 -51
- package/fesm2022/sd-angular-core-components-chart.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-tab-router.mjs +5 -15
- package/fesm2022/sd-angular-core-components-tab-router.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-table.mjs +157 -113
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/package.json +72 -72
- package/sd-angular-core-19.0.0-beta.74.tgz +0 -0
- package/components/table/src/components/desktop-cell-view/desktop-cell-view.component.d.ts +0 -28
- package/sd-angular-core-19.0.0-beta.73.tgz +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as i1 from '@angular/common';
|
|
1
|
+
import * as i1$1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, inject, ElementRef, effect, Component,
|
|
4
|
+
import { input, inject, ElementRef, effect, Component, output, ChangeDetectionStrategy, viewChild, contentChildren, booleanAttribute, signal, afterNextRender } from '@angular/core';
|
|
5
5
|
import { v4 } from 'uuid';
|
|
6
|
-
import * as i2 from '@angular/material/icon';
|
|
7
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
8
6
|
import { Subject, Subscription, debounceTime, fromEvent, auditTime, map, filter, take } from 'rxjs';
|
|
7
|
+
import * as i1 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
9
|
|
|
10
10
|
class SdAnchorItemV2 {
|
|
11
11
|
title = input.required();
|
|
@@ -28,195 +28,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
28
28
|
}], ctorParameters: () => [] });
|
|
29
29
|
|
|
30
30
|
class SdAnchorVerticalListV2 {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
sdClickSection = new EventEmitter();
|
|
31
|
+
sections = input.required();
|
|
32
|
+
activeSectionId = input('');
|
|
33
|
+
ellipsis = input(false);
|
|
34
|
+
sidebarWidth = input('');
|
|
35
|
+
sdClickSection = output();
|
|
37
36
|
#delay = 200;
|
|
38
37
|
#clickSectionSubject = new Subject();
|
|
39
38
|
#subscription = new Subscription();
|
|
40
|
-
|
|
41
|
-
this.#subscription.add(this.#clickSectionSubject
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
constructor() {
|
|
40
|
+
this.#subscription.add(this.#clickSectionSubject
|
|
41
|
+
.pipe(debounceTime(this.#delay))
|
|
42
|
+
.subscribe((id) => this.sdClickSection.emit(id)));
|
|
44
43
|
}
|
|
45
|
-
onClickSection = (
|
|
46
|
-
this.#clickSectionSubject.next(
|
|
44
|
+
onClickSection = (id) => {
|
|
45
|
+
this.#clickSectionSubject.next(id);
|
|
47
46
|
};
|
|
48
47
|
ngOnDestroy() {
|
|
49
|
-
this.#subscription
|
|
48
|
+
this.#subscription.unsubscribe();
|
|
50
49
|
}
|
|
51
50
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAnchorVerticalListV2, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
52
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdAnchorVerticalListV2, isStandalone: true, selector: "sd-anchor-vertical-list-v2", inputs: { sections: "sections", activeSectionId: "activeSectionId", ellipsis: "ellipsis", sidebarWidth: "sidebarWidth" }, outputs: { sdClickSection: "sdClickSection" }, ngImport: i0, template: "<div class=\"c-anchor-list\" [style.width]=\"sidebarWidth\">\
|
|
51
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdAnchorVerticalListV2, isStandalone: true, selector: "sd-anchor-vertical-list-v2", inputs: { sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: true, transformFunction: null }, activeSectionId: { classPropertyName: "activeSectionId", publicName: "activeSectionId", isSignal: true, isRequired: false, transformFunction: null }, ellipsis: { classPropertyName: "ellipsis", publicName: "ellipsis", isSignal: true, isRequired: false, transformFunction: null }, sidebarWidth: { classPropertyName: "sidebarWidth", publicName: "sidebarWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sdClickSection: "sdClickSection" }, ngImport: i0, template: "<div class=\"c-anchor-list\" [style.width]=\"sidebarWidth()\">\n @for (section of sections(); track section.id) {\n <div\n class=\"c-anchor-list-item\"\n [class.active]=\"section.id === activeSectionId()\"\n (click)=\"onClickSection(section.id)\"\n (keydown.enter)=\"onClickSection(section.id)\"\n tabindex=\"0\">\n @if (section.icon()) {\n <mat-icon class=\"c-anchor-list-item-icon\">{{ section.icon() }}</mat-icon>\n }\n <div class=\"c-anchor-list-item-text\" [class.ellipsis]=\"ellipsis()\">\n {{ section.title() }}\n </div>\n </div>\n }\n</div>\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.c-anchor-list{height:100%;display:flex;flex-direction:column}.c-anchor-list .c-anchor-list-item{border-left:2px solid var(--sd-secondary-light);color:var(--sd-black500);padding:.5rem 1.5rem;cursor:pointer;display:flex;align-items:center;gap:.5rem}.c-anchor-list .c-anchor-list-item .c-anchor-list-item-text{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.c-anchor-list .c-anchor-list-item .c-anchor-list-item-text.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-anchor-list .c-anchor-list-item.active{border-left:2px solid var(--sd-primary);font-weight:700}.c-anchor-list .c-anchor-list-item:not(.active){border-left:2px solid var(--sd-secondary-light);font-weight:400}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
53
52
|
}
|
|
54
53
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAnchorVerticalListV2, decorators: [{
|
|
55
54
|
type: Component,
|
|
56
|
-
args: [{ selector: 'sd-anchor-vertical-list-v2', imports: [CommonModule, MatIconModule], standalone: true, template: "<div class=\"c-anchor-list\" [style.width]=\"sidebarWidth\">\
|
|
57
|
-
}], ctorParameters: () => []
|
|
58
|
-
type: Input
|
|
59
|
-
}], activeSectionId: [{
|
|
60
|
-
type: Input
|
|
61
|
-
}], ellipsis: [{
|
|
62
|
-
type: Input
|
|
63
|
-
}], sidebarWidth: [{
|
|
64
|
-
type: Input
|
|
65
|
-
}], sdClickSection: [{
|
|
66
|
-
type: Output
|
|
67
|
-
}] } });
|
|
55
|
+
args: [{ selector: 'sd-anchor-vertical-list-v2', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, MatIconModule], standalone: true, template: "<div class=\"c-anchor-list\" [style.width]=\"sidebarWidth()\">\n @for (section of sections(); track section.id) {\n <div\n class=\"c-anchor-list-item\"\n [class.active]=\"section.id === activeSectionId()\"\n (click)=\"onClickSection(section.id)\"\n (keydown.enter)=\"onClickSection(section.id)\"\n tabindex=\"0\">\n @if (section.icon()) {\n <mat-icon class=\"c-anchor-list-item-icon\">{{ section.icon() }}</mat-icon>\n }\n <div class=\"c-anchor-list-item-text\" [class.ellipsis]=\"ellipsis()\">\n {{ section.title() }}\n </div>\n </div>\n }\n</div>\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.c-anchor-list{height:100%;display:flex;flex-direction:column}.c-anchor-list .c-anchor-list-item{border-left:2px solid var(--sd-secondary-light);color:var(--sd-black500);padding:.5rem 1.5rem;cursor:pointer;display:flex;align-items:center;gap:.5rem}.c-anchor-list .c-anchor-list-item .c-anchor-list-item-text{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.c-anchor-list .c-anchor-list-item .c-anchor-list-item-text.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-anchor-list .c-anchor-list-item.active{border-left:2px solid var(--sd-primary);font-weight:700}.c-anchor-list .c-anchor-list-item:not(.active){border-left:2px solid var(--sd-secondary-light);font-weight:400}\n"] }]
|
|
56
|
+
}], ctorParameters: () => [] });
|
|
68
57
|
|
|
69
58
|
class SdAnchorV2 {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
set _ellipsis(value) {
|
|
81
|
-
this.ellipsis = value === '' || !!value;
|
|
82
|
-
}
|
|
83
|
-
isOverscroll = false; // Có cho phép scroll vượt qua sd-anchor và scroll tiếp đến phần tử bên ngoài?
|
|
84
|
-
set _isOverscroll(value) {
|
|
85
|
-
this.isOverscroll = value === '' || !!value;
|
|
86
|
-
}
|
|
87
|
-
isHiddenAnchorList = false; // Có ẩn danh sách tiêu đề section hay không?
|
|
88
|
-
set _isHiddenAnchorList(value) {
|
|
89
|
-
this.isHiddenAnchorList = value === '' || !!value;
|
|
90
|
-
}
|
|
91
|
-
// RxJS
|
|
92
|
-
// Note : Scroll bằng con lăn chuột hay scroll bằng click thì tại 1 thời điểm chỉ được lắng nghe 1 Rxjs
|
|
93
|
-
#scrollSubscription = new Subscription(); // Scroll bằng con lăn chuột
|
|
94
|
-
#clickScrollSubscription = new Subscription(); // Scroll bằng click
|
|
95
|
-
// End
|
|
96
|
-
// Variables Private
|
|
59
|
+
wrapper = viewChild.required('wrapper');
|
|
60
|
+
sections = contentChildren(SdAnchorItemV2);
|
|
61
|
+
type = input('vertical');
|
|
62
|
+
sidebarWidth = input('200px');
|
|
63
|
+
ellipsis = input(false, { transform: booleanAttribute });
|
|
64
|
+
isOverscroll = input(false, { transform: booleanAttribute });
|
|
65
|
+
isHiddenAnchorList = input(false, { transform: booleanAttribute });
|
|
66
|
+
activeSectionId = signal('');
|
|
67
|
+
#scrollSubscription = new Subscription();
|
|
68
|
+
#clickScrollSubscription = new Subscription();
|
|
97
69
|
#delay = 100;
|
|
98
70
|
#currentScrollTop = 0;
|
|
99
71
|
#timeoutId = null;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.#registerScrollSubscription(); // Đăng ký Rxjs Scroll bằng con lăn chuột
|
|
108
|
-
this.#setWidthAnchorContent();
|
|
109
|
-
}
|
|
72
|
+
constructor() {
|
|
73
|
+
afterNextRender(() => {
|
|
74
|
+
if (!this.isHiddenAnchorList()) {
|
|
75
|
+
this.activeSectionId.set(this.sections()[0]?.id ?? '');
|
|
76
|
+
this.#registerScrollSubscription();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
110
79
|
}
|
|
111
80
|
#registerScrollSubscription = () => {
|
|
112
|
-
this.#disposeResources();
|
|
113
|
-
const wrapperEl = this.wrapper.nativeElement;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const rect = section
|
|
81
|
+
this.#disposeResources();
|
|
82
|
+
const wrapperEl = this.wrapper().nativeElement;
|
|
83
|
+
this.#scrollSubscription = fromEvent(wrapperEl, 'scroll')
|
|
84
|
+
.pipe(auditTime(50))
|
|
85
|
+
.subscribe((event) => {
|
|
86
|
+
const el = event.target;
|
|
87
|
+
this.#currentScrollTop = this.#updateCurrentScroll(el);
|
|
88
|
+
for (const section of this.sections()) {
|
|
89
|
+
const rect = section.elementRef.nativeElement;
|
|
121
90
|
const rectTop = rect.offsetTop;
|
|
122
91
|
const rectBottom = rectTop + rect.offsetHeight;
|
|
123
|
-
// End
|
|
124
92
|
if (this.#currentScrollTop >= rectTop && this.#currentScrollTop < rectBottom) {
|
|
125
|
-
this.activeSectionId
|
|
93
|
+
this.activeSectionId.set(section.id);
|
|
126
94
|
break;
|
|
127
95
|
}
|
|
128
96
|
}
|
|
129
97
|
});
|
|
130
98
|
};
|
|
131
99
|
scrollSectionByClick(idSectionTarget) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.activeSectionId = idSectionTarget;
|
|
136
|
-
const targetSection = this.sections.find(s => s?.id === this.activeSectionId)?.elementRef;
|
|
137
|
-
if (!targetSection) {
|
|
100
|
+
this.activeSectionId.set(idSectionTarget);
|
|
101
|
+
const targetSection = this.sections().find(s => s.id === idSectionTarget)?.elementRef;
|
|
102
|
+
if (!targetSection)
|
|
138
103
|
return;
|
|
139
|
-
|
|
140
|
-
this
|
|
141
|
-
const wrapperEl = this.wrapper.nativeElement;
|
|
104
|
+
this.#disposeResources();
|
|
105
|
+
const wrapperEl = this.wrapper().nativeElement;
|
|
142
106
|
const targetElement = targetSection.nativeElement;
|
|
143
|
-
const prevScrollTop = this.#currentScrollTop;
|
|
144
|
-
|
|
145
|
-
const clickScrollEnd$ = fromEvent(wrapperEl, 'scroll');
|
|
146
|
-
this.#clickScrollSubscription = clickScrollEnd$
|
|
107
|
+
const prevScrollTop = this.#currentScrollTop;
|
|
108
|
+
this.#clickScrollSubscription = fromEvent(wrapperEl, 'scroll')
|
|
147
109
|
.pipe(auditTime(this.#delay), map((event) => {
|
|
148
|
-
const
|
|
149
|
-
this.#currentScrollTop = this.#updateCurrentScroll(
|
|
110
|
+
const el = event.target;
|
|
111
|
+
this.#currentScrollTop = this.#updateCurrentScroll(el);
|
|
150
112
|
const wrapperTop = wrapperEl.getBoundingClientRect().top;
|
|
151
113
|
const targetRect = targetElement.getBoundingClientRect();
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
return Math.abs(targetTop - wrapperTop) < 1 || isVisible; // Đã được scroll tới hoặc element đã nằm trong vùng viewPort
|
|
114
|
+
const isVisible = targetRect.top >= 0 && targetRect.bottom <= window.innerHeight;
|
|
115
|
+
return Math.abs(targetRect.top - wrapperTop) < 1 || isVisible;
|
|
155
116
|
}), filter(Boolean), debounceTime(this.#delay + 100), take(1))
|
|
156
|
-
.subscribe(() =>
|
|
157
|
-
this.#registerScrollSubscription(); // Đã xác nhận scroll xong thì mới đăng ký lại Rxjs Scroll bằng con lăn chuột
|
|
158
|
-
});
|
|
159
|
-
// // End
|
|
160
|
-
// Case 2: Nếu không được scroll thì sau (#delay + 100) đăng ký lại Rxjs Scroll bằng con lăn chuột
|
|
117
|
+
.subscribe(() => this.#registerScrollSubscription());
|
|
161
118
|
this.#timeoutId = setTimeout(() => {
|
|
162
119
|
if (prevScrollTop === this.#currentScrollTop) {
|
|
163
120
|
this.#registerScrollSubscription();
|
|
164
121
|
}
|
|
165
122
|
}, this.#delay + 100);
|
|
166
|
-
wrapperEl.scrollTo({ top: targetElement.offsetTop, behavior: 'smooth' });
|
|
167
|
-
// End
|
|
123
|
+
wrapperEl.scrollTo({ top: targetElement.offsetTop, behavior: 'smooth' });
|
|
168
124
|
}
|
|
169
|
-
#updateCurrentScroll(
|
|
170
|
-
const style = getComputedStyle(
|
|
171
|
-
|
|
172
|
-
const borderTop = parseFloat(style.borderTopWidth);
|
|
173
|
-
return elementTarget.scrollTop + paddingTop + borderTop; // Vị trí scroll thực tế nếu có padding, border
|
|
125
|
+
#updateCurrentScroll(el) {
|
|
126
|
+
const style = getComputedStyle(el);
|
|
127
|
+
return el.scrollTop + parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth);
|
|
174
128
|
}
|
|
175
|
-
// Giải phóng tất cả subscription và timer đang hoạt động
|
|
176
129
|
#disposeResources = () => {
|
|
177
|
-
if (this.#timeoutId)
|
|
130
|
+
if (this.#timeoutId)
|
|
178
131
|
clearTimeout(this.#timeoutId);
|
|
179
|
-
}
|
|
180
132
|
this.#scrollSubscription?.unsubscribe();
|
|
181
133
|
this.#clickScrollSubscription?.unsubscribe();
|
|
182
134
|
};
|
|
183
|
-
// Thiết lập chiều rộng nội dung phụ thuộc vào chiều rộng danh sách tiêu đề section
|
|
184
|
-
#setWidthAnchorContent = () => {
|
|
185
|
-
const gap = '16px'; // Khoảng cách giữa nội dung và danh sách tiêu đề section
|
|
186
|
-
this.renderer.setStyle(this.anchorContent.nativeElement, 'width', `calc(100% - ${this.sidebarWidth} - ${gap})`);
|
|
187
|
-
};
|
|
188
135
|
ngOnDestroy() {
|
|
189
136
|
this.#disposeResources();
|
|
190
137
|
}
|
|
191
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAnchorV2, deps: [
|
|
192
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdAnchorV2, isStandalone: true, selector: "sd-anchor-v2", inputs: { type: "type",
|
|
138
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAnchorV2, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
139
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdAnchorV2, isStandalone: true, selector: "sd-anchor-v2", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, sidebarWidth: { classPropertyName: "sidebarWidth", publicName: "sidebarWidth", isSignal: true, isRequired: false, transformFunction: null }, ellipsis: { classPropertyName: "ellipsis", publicName: "ellipsis", isSignal: true, isRequired: false, transformFunction: null }, isOverscroll: { classPropertyName: "isOverscroll", publicName: "isOverscroll", isSignal: true, isRequired: false, transformFunction: null }, isHiddenAnchorList: { classPropertyName: "isHiddenAnchorList", publicName: "isHiddenAnchorList", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "sections", predicate: SdAnchorItemV2, isSignal: true }], viewQueries: [{ propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"c-anchor-vertical\" [ngClass]=\"{ 'c-stop-scroll-propagation': !isOverscroll() }\" #wrapper>\n <div class=\"c-anchor-content\" [style.width]=\"'calc(100% - ' + sidebarWidth() + ' - 16px)'\">\n <ng-content></ng-content>\n </div>\n\n @if (!isHiddenAnchorList()) {\n <div class=\"c-anchor-list\" [style.width]=\"sidebarWidth()\">\n <sd-anchor-vertical-list-v2\n [sections]=\"sections()\"\n [ellipsis]=\"ellipsis()\"\n [sidebarWidth]=\"sidebarWidth()\"\n [activeSectionId]=\"activeSectionId()\"\n (sdClickSection)=\"scrollSectionByClick($event)\">\n </sd-anchor-vertical-list-v2>\n </div>\n }\n</div>\n", styles: ["@charset \"UTF-8\";.c-anchor-vertical{position:relative;display:flex;height:100%;width:100%;gap:16px;overflow-y:auto}.c-anchor-vertical.c-stop-scroll-propagation{overscroll-behavior:contain}.c-anchor-vertical .c-anchor-content{width:100%}.c-anchor-vertical .c-anchor-list{position:sticky;top:0;right:6px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SdAnchorVerticalListV2, selector: "sd-anchor-vertical-list-v2", inputs: ["sections", "activeSectionId", "ellipsis", "sidebarWidth"], outputs: ["sdClickSection"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
193
140
|
}
|
|
194
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdAnchorV2, decorators: [{
|
|
195
142
|
type: Component,
|
|
196
|
-
args: [{ selector: 'sd-anchor-v2', imports: [CommonModule, SdAnchorVerticalListV2], standalone: true, template: "<div class=\"c-anchor-vertical\" [ngClass]=\"{ 'c-stop-scroll-propagation': !isOverscroll }\" #wrapper>\
|
|
197
|
-
}], ctorParameters: () => [
|
|
198
|
-
type: ViewChild,
|
|
199
|
-
args: ['wrapper', { static: false }]
|
|
200
|
-
}], anchorContent: [{
|
|
201
|
-
type: ViewChild,
|
|
202
|
-
args: ['anchorContent', { static: false }]
|
|
203
|
-
}], sections: [{
|
|
204
|
-
type: ContentChildren,
|
|
205
|
-
args: [SdAnchorItemV2]
|
|
206
|
-
}], type: [{
|
|
207
|
-
type: Input
|
|
208
|
-
}], sidebarWidth: [{
|
|
209
|
-
type: Input
|
|
210
|
-
}], _ellipsis: [{
|
|
211
|
-
type: Input,
|
|
212
|
-
args: ['ellipsis']
|
|
213
|
-
}], _isOverscroll: [{
|
|
214
|
-
type: Input,
|
|
215
|
-
args: ['isOverscroll']
|
|
216
|
-
}], _isHiddenAnchorList: [{
|
|
217
|
-
type: Input,
|
|
218
|
-
args: ['isHiddenAnchorList']
|
|
219
|
-
}] } });
|
|
143
|
+
args: [{ selector: 'sd-anchor-v2', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, SdAnchorVerticalListV2], standalone: true, template: "<div class=\"c-anchor-vertical\" [ngClass]=\"{ 'c-stop-scroll-propagation': !isOverscroll() }\" #wrapper>\n <div class=\"c-anchor-content\" [style.width]=\"'calc(100% - ' + sidebarWidth() + ' - 16px)'\">\n <ng-content></ng-content>\n </div>\n\n @if (!isHiddenAnchorList()) {\n <div class=\"c-anchor-list\" [style.width]=\"sidebarWidth()\">\n <sd-anchor-vertical-list-v2\n [sections]=\"sections()\"\n [ellipsis]=\"ellipsis()\"\n [sidebarWidth]=\"sidebarWidth()\"\n [activeSectionId]=\"activeSectionId()\"\n (sdClickSection)=\"scrollSectionByClick($event)\">\n </sd-anchor-vertical-list-v2>\n </div>\n }\n</div>\n", styles: ["@charset \"UTF-8\";.c-anchor-vertical{position:relative;display:flex;height:100%;width:100%;gap:16px;overflow-y:auto}.c-anchor-vertical.c-stop-scroll-propagation{overscroll-behavior:contain}.c-anchor-vertical .c-anchor-content{width:100%}.c-anchor-vertical .c-anchor-list{position:sticky;top:0;right:6px}\n"] }]
|
|
144
|
+
}], ctorParameters: () => [] });
|
|
220
145
|
|
|
221
146
|
/**
|
|
222
147
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-components-anchor-v2.mjs","sources":["../../../projects/sd-angular/components/anchor-v2/src/components/anchor-item-v2/anchor-item-v2.component.ts","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-item-v2/anchor-item-v2.component.html","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-vertical-v2/anchor-vertical-list-v2.component.ts","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-vertical-v2/anchor-vertical-list-v2.component.html","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-v2/anchor-v2.component.ts","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-v2/anchor-v2.component.html","../../../projects/sd-angular/components/anchor-v2/sd-angular-core-components-anchor-v2.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport { Component, ElementRef, effect, inject, input } from '@angular/core';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { IAnchorItemV2 } from '../../models';\r\n\r\n@Component({\r\n selector: 'sd-anchor-item-v2',\r\n templateUrl: './anchor-item-v2.component.html',\r\n styleUrls: ['./anchor-item-v2.component.scss'],\r\n imports: [CommonModule],\r\n standalone: true,\r\n})\r\nexport class SdAnchorItemV2 implements IAnchorItemV2 {\r\n title = input.required<string>();\r\n icon = input<string | undefined>();\r\n id: string = uuidv4();\r\n elementRef = inject(ElementRef);\r\n\r\n constructor() {\r\n effect(() => {\r\n if (this.title()) {\r\n this.elementRef.nativeElement.removeAttribute('title');\r\n }\r\n });\r\n }\r\n}\r\n","<section>\r\n <ng-content></ng-content>\r\n</section>\r\n","import { CommonModule } from '@angular/common';\r\nimport { Component, ContentChildren, EventEmitter, Input, OnInit, Output, QueryList } from '@angular/core';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { debounceTime, Subject, Subscription } from 'rxjs';\r\nimport { SdAnchorItemV2 } from '../anchor-item-v2/anchor-item-v2.component';\r\n\r\n@Component({\r\n selector: 'sd-anchor-vertical-list-v2',\r\n templateUrl: './anchor-vertical-list-v2.component.html',\r\n styleUrl: './anchor-vertical-list-v2.component.scss',\r\n imports: [CommonModule, MatIconModule],\r\n standalone: true,\r\n})\r\nexport class SdAnchorVerticalListV2 implements OnInit {\r\n constructor() {}\r\n @Input() sections!: QueryList<SdAnchorItemV2>;\r\n @Input() activeSectionId: string = '';\r\n @Input() ellipsis!: boolean;\r\n @Input() sidebarWidth!: string;\r\n\r\n @Output() sdClickSection = new EventEmitter<string>();\r\n\r\n #delay: number = 200;\r\n #clickSectionSubject = new Subject<string>();\r\n #subscription = new Subscription();\r\n\r\n ngOnInit() {\r\n this.#subscription.add(\r\n this.#clickSectionSubject.pipe(debounceTime(this.#delay)).subscribe((idSectionTarget: string) => {\r\n this.sdClickSection.emit(idSectionTarget);\r\n })\r\n );\r\n }\r\n\r\n onClickSection = (idSectionTarget: string): void => {\r\n this.#clickSectionSubject.next(idSectionTarget);\r\n };\r\n \r\n ngOnDestroy() {\r\n this.#subscription?.unsubscribe();\r\n }\r\n}\r\n","<div class=\"c-anchor-list\" [style.width]=\"sidebarWidth\">\r\n @for (section of sections; track section.id) {\r\n <div\r\n class=\"c-anchor-list-item\"\r\n [class.active]=\"section.id === activeSectionId\"\r\n (click)=\"onClickSection(section.id)\"\r\n (keydown.enter)=\"onClickSection(section.id)\"\r\n tabindex=\"0\">\r\n @if (section?.icon()) {\r\n <mat-icon class=\"c-anchor-list-item-icon\">{{ section?.icon() }}</mat-icon>\r\n }\r\n <div\r\n class=\"c-anchor-list-item-text\"\r\n [ngClass]=\"{\r\n ellipsis\r\n }\">\r\n {{ section.title() }}\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n","import { AfterViewInit, Component, ContentChildren, ElementRef, Input, QueryList, Renderer2, ViewChild } from '@angular/core';\r\nimport { SdAnchorVerticalListV2 } from '../anchor-vertical-v2/anchor-vertical-list-v2.component';\r\nimport { SdAnchorItemV2 } from '../anchor-item-v2/anchor-item-v2.component';\r\nimport { auditTime, debounceTime, filter, fromEvent, map, Subscription, take } from 'rxjs';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n@Component({\r\n selector: 'sd-anchor-v2',\r\n templateUrl: './anchor-v2.component.html',\r\n styleUrls: ['./anchor-v2.component.scss'],\r\n imports: [CommonModule, SdAnchorVerticalListV2],\r\n standalone: true,\r\n})\r\nexport class SdAnchorV2 implements AfterViewInit {\r\n constructor(private renderer: Renderer2) {}\r\n @ViewChild('wrapper', { static: false }) wrapper!: ElementRef;\r\n @ViewChild('anchorContent', { static: false }) anchorContent!: ElementRef;\r\n\r\n @ContentChildren(SdAnchorItemV2) sections!: QueryList<SdAnchorItemV2>; // Danh sách sd-anchor-v2 được khai báo\r\n\r\n @Input() type: 'vertical' | 'horizontal' = 'vertical';\r\n @Input() sidebarWidth: string = '200px'; // Độ rộng của danh sách tiêu đề\r\n\r\n ellipsis = false; // Có thu gọn tiêu đề bằng dấu 3 chấm?\r\n @Input('ellipsis') set _ellipsis(value: '' | boolean | undefined | null) {\r\n this.ellipsis = value === '' || !!value;\r\n }\r\n\r\n isOverscroll = false; // Có cho phép scroll vượt qua sd-anchor và scroll tiếp đến phần tử bên ngoài?\r\n @Input('isOverscroll') set _isOverscroll(value: '' | boolean | undefined | null) {\r\n this.isOverscroll = value === '' || !!value;\r\n }\r\n\r\n isHiddenAnchorList = false; // Có ẩn danh sách tiêu đề section hay không?\r\n @Input('isHiddenAnchorList') set _isHiddenAnchorList(value: '' | boolean | undefined | null) {\r\n this.isHiddenAnchorList = value === '' || !!value;\r\n }\r\n\r\n // RxJS\r\n // Note : Scroll bằng con lăn chuột hay scroll bằng click thì tại 1 thời điểm chỉ được lắng nghe 1 Rxjs\r\n #scrollSubscription = new Subscription(); // Scroll bằng con lăn chuột\r\n #clickScrollSubscription = new Subscription(); // Scroll bằng click\r\n // End\r\n\r\n // Variables Private\r\n #delay: number = 100;\r\n #currentScrollTop: number = 0;\r\n #timeoutId: ReturnType<typeof setTimeout> | null = null;\r\n // End\r\n\r\n // Variables Public\r\n activeSectionId: string = '';\r\n // End\r\n\r\n ngAfterViewInit(): void {\r\n if (!this.isHiddenAnchorList) {\r\n this.activeSectionId = this.sections?.first?.id ?? ''; // Active section đầu tiên\r\n this.#registerScrollSubscription(); // Đăng ký Rxjs Scroll bằng con lăn chuột\r\n this.#setWidthAnchorContent()\r\n }\r\n }\r\n\r\n #registerScrollSubscription = (): void => {\r\n this.#disposeResources(); // Giải phóng tất cả subscription và timer cũ\r\n const wrapperEl = this.wrapper.nativeElement;\r\n const scroll$ = fromEvent<UIEvent>(wrapperEl, 'scroll').pipe(debounceTime(this.#delay));\r\n this.#scrollSubscription = scroll$.subscribe((event: UIEvent) => {\r\n const elementTarget = event.target as HTMLElement;\r\n this.#currentScrollTop = this.#updateCurrentScroll(elementTarget); // Ví trí scroll hiện tại\r\n for (const section of this.sections) {\r\n // Vùng section chiếm diện tích\r\n const rect = section?.elementRef?.nativeElement;\r\n const rectTop = rect.offsetTop;\r\n const rectBottom = rectTop + rect.offsetHeight;\r\n // End\r\n if (this.#currentScrollTop >= rectTop && this.#currentScrollTop < rectBottom) {\r\n this.activeSectionId = section?.id;\r\n break;\r\n }\r\n }\r\n });\r\n };\r\n\r\n scrollSectionByClick(idSectionTarget: string): void {\r\n // Khi scrollByClick sẽ có 2 case xảy ra:\r\n // Case 1 : Được scroll (ElementTarget không nằm trong vùng viewport và được scroll đến vị trí)\r\n // Case 2 : Không được scroll (ElementTarget đã được scroll trước đó hoặc đã nằm trong vùng viewport luôn)\r\n\r\n this.activeSectionId = idSectionTarget;\r\n const targetSection = this.sections.find(s => s?.id === this.activeSectionId)?.elementRef;\r\n if (!targetSection) {\r\n return;\r\n }\r\n\r\n this.#disposeResources(); // Giải phóng tất cả subscription và timer cũ\r\n const wrapperEl = this.wrapper.nativeElement;\r\n const targetElement = targetSection.nativeElement;\r\n const prevScrollTop = this.#currentScrollTop; // Lưu lại ví trí trước khi scroll bởi event click\r\n\r\n // Case 1: Nếu được Scroll check điều kiện để đăng ký lại Rxjs Scroll bằng con lăn chuột\r\n const clickScrollEnd$ = fromEvent<UIEvent>(wrapperEl, 'scroll');\r\n this.#clickScrollSubscription = clickScrollEnd$\r\n .pipe(\r\n auditTime(this.#delay),\r\n map((event: UIEvent) => {\r\n const elementTarget = event.target as HTMLElement;\r\n this.#currentScrollTop = this.#updateCurrentScroll(elementTarget); // Cập nhật vị trí sau mỗi lần #delay\r\n const wrapperTop = wrapperEl.getBoundingClientRect().top;\r\n const targetRect = targetElement.getBoundingClientRect();\r\n const targetTop = targetRect.top;\r\n const isVisible = targetRect.top >= 0 && targetRect.bottom <= window.innerHeight; // Nằm trong viewPort\r\n return Math.abs(targetTop - wrapperTop) < 1 || isVisible; // Đã được scroll tới hoặc element đã nằm trong vùng viewPort\r\n }),\r\n filter(Boolean),\r\n debounceTime(this.#delay + 100),\r\n take(1)\r\n )\r\n .subscribe(() => {\r\n this.#registerScrollSubscription(); // Đã xác nhận scroll xong thì mới đăng ký lại Rxjs Scroll bằng con lăn chuột\r\n });\r\n // // End\r\n\r\n // Case 2: Nếu không được scroll thì sau (#delay + 100) đăng ký lại Rxjs Scroll bằng con lăn chuột\r\n this.#timeoutId = setTimeout(() => {\r\n if (prevScrollTop === this.#currentScrollTop) {\r\n this.#registerScrollSubscription();\r\n }\r\n }, this.#delay + 100);\r\n\r\n wrapperEl.scrollTo({ top: targetElement.offsetTop, behavior: 'smooth' }); // Action scroll\r\n // End\r\n }\r\n\r\n #updateCurrentScroll(elementTarget: HTMLElement): number {\r\n const style = getComputedStyle(elementTarget);\r\n const paddingTop = parseFloat(style.paddingTop);\r\n const borderTop = parseFloat(style.borderTopWidth);\r\n return elementTarget.scrollTop + paddingTop + borderTop; // Vị trí scroll thực tế nếu có padding, border\r\n }\r\n\r\n // Giải phóng tất cả subscription và timer đang hoạt động\r\n #disposeResources = (): void => {\r\n if (this.#timeoutId) {\r\n clearTimeout(this.#timeoutId);\r\n }\r\n this.#scrollSubscription?.unsubscribe();\r\n this.#clickScrollSubscription?.unsubscribe();\r\n };\r\n\r\n // Thiết lập chiều rộng nội dung phụ thuộc vào chiều rộng danh sách tiêu đề section\r\n #setWidthAnchorContent = (): void => {\r\n const gap = '16px'; // Khoảng cách giữa nội dung và danh sách tiêu đề section\r\n this.renderer.setStyle(this.anchorContent.nativeElement, 'width', `calc(100% - ${this.sidebarWidth} - ${gap})`);\r\n };\r\n\r\n ngOnDestroy(): void {\r\n this.#disposeResources();\r\n }\r\n}\r\n","<div class=\"c-anchor-vertical\" [ngClass]=\"{ 'c-stop-scroll-propagation': !isOverscroll }\" #wrapper>\r\n <!-- Nội dung -->\r\n <div class=\"c-anchor-content\" #anchorContent>\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <!-- Danh sách tiêu đề các sections-->\r\n @if(!isHiddenAnchorList){\r\n <div class=\"c-anchor-list\" [style.width]=\"sidebarWidth\">\r\n <sd-anchor-vertical-list-v2\r\n [sections]=\"sections\"\r\n [ellipsis]=\"ellipsis\"\r\n [sidebarWidth]=\"sidebarWidth\"\r\n [activeSectionId]=\"activeSectionId\"\r\n (sdClickSection)=\"scrollSectionByClick($event)\">\r\n </sd-anchor-vertical-list-v2>\r\n </div>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuidv4"],"mappings":";;;;;;;;;MAYa,cAAc,CAAA;AACzB,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;IAChC,IAAI,GAAG,KAAK,EAAsB;IAClC,EAAE,GAAWA,EAAM,EAAE;AACrB,IAAA,UAAU,GAAG,MAAM,CAAC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EAAA,CAAA,EAAA,CAAA;;4FAGnC,UAAU,EAAA,UAAA,EAAA,CAAA;kBAPtB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,cAAc,WAGf,CAAC,YAAY,EAAE,sBAAsB,CAAC,cACnC,IAAI,EAAA,QAAA,EAAA,6uBAAA,EAAA,MAAA,EAAA,CAAA,oTAAA,CAAA,EAAA;8EAIyB,OAAO,EAAA,CAAA;sBAA/C,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;gBACQ,aAAa,EAAA,CAAA;sBAA3D,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;gBAEZ,QAAQ,EAAA,CAAA;sBAAxC,eAAe;uBAAC,cAAc;gBAEtB,IAAI,EAAA,CAAA;sBAAZ;gBACQ,YAAY,EAAA,CAAA;sBAApB;gBAGsB,SAAS,EAAA,CAAA;sBAA/B,KAAK;uBAAC,UAAU;gBAKU,aAAa,EAAA,CAAA;sBAAvC,KAAK;uBAAC,cAAc;gBAKY,mBAAmB,EAAA,CAAA;sBAAnD,KAAK;uBAAC,oBAAoB;;;AElC7B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-components-anchor-v2.mjs","sources":["../../../projects/sd-angular/components/anchor-v2/src/components/anchor-item-v2/anchor-item-v2.component.ts","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-item-v2/anchor-item-v2.component.html","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-vertical-v2/anchor-vertical-list-v2.component.ts","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-vertical-v2/anchor-vertical-list-v2.component.html","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-v2/anchor-v2.component.ts","../../../projects/sd-angular/components/anchor-v2/src/components/anchor-v2/anchor-v2.component.html","../../../projects/sd-angular/components/anchor-v2/sd-angular-core-components-anchor-v2.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport { Component, ElementRef, effect, inject, input } from '@angular/core';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { IAnchorItemV2 } from '../../models';\r\n\r\n@Component({\r\n selector: 'sd-anchor-item-v2',\r\n templateUrl: './anchor-item-v2.component.html',\r\n styleUrls: ['./anchor-item-v2.component.scss'],\r\n imports: [CommonModule],\r\n standalone: true,\r\n})\r\nexport class SdAnchorItemV2 implements IAnchorItemV2 {\r\n title = input.required<string>();\r\n icon = input<string | undefined>();\r\n id: string = uuidv4();\r\n elementRef = inject(ElementRef);\r\n\r\n constructor() {\r\n effect(() => {\r\n if (this.title()) {\r\n this.elementRef.nativeElement.removeAttribute('title');\r\n }\r\n });\r\n }\r\n}\r\n","<section>\r\n <ng-content></ng-content>\r\n</section>\r\n","import { ChangeDetectionStrategy, Component, OnDestroy, input, output } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatIconModule } from '@angular/material/icon';\nimport { Subject, Subscription, debounceTime } from 'rxjs';\n\nimport { SdAnchorItemV2 } from '../anchor-item-v2/anchor-item-v2.component';\n\n@Component({\n selector: 'sd-anchor-vertical-list-v2',\n templateUrl: './anchor-vertical-list-v2.component.html',\n styleUrl: './anchor-vertical-list-v2.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, MatIconModule],\n standalone: true,\n})\nexport class SdAnchorVerticalListV2 implements OnDestroy {\n sections = input.required<readonly SdAnchorItemV2[]>();\n activeSectionId = input<string>('');\n ellipsis = input<boolean>(false);\n sidebarWidth = input<string>('');\n\n sdClickSection = output<string>();\n\n #delay = 200;\n #clickSectionSubject = new Subject<string>();\n #subscription = new Subscription();\n\n constructor() {\n this.#subscription.add(\n this.#clickSectionSubject\n .pipe(debounceTime(this.#delay))\n .subscribe((id: string) => this.sdClickSection.emit(id))\n );\n }\n\n onClickSection = (id: string): void => {\n this.#clickSectionSubject.next(id);\n };\n\n ngOnDestroy(): void {\n this.#subscription.unsubscribe();\n }\n}\n","<div class=\"c-anchor-list\" [style.width]=\"sidebarWidth()\">\n @for (section of sections(); track section.id) {\n <div\n class=\"c-anchor-list-item\"\n [class.active]=\"section.id === activeSectionId()\"\n (click)=\"onClickSection(section.id)\"\n (keydown.enter)=\"onClickSection(section.id)\"\n tabindex=\"0\">\n @if (section.icon()) {\n <mat-icon class=\"c-anchor-list-item-icon\">{{ section.icon() }}</mat-icon>\n }\n <div class=\"c-anchor-list-item-text\" [class.ellipsis]=\"ellipsis()\">\n {{ section.title() }}\n </div>\n </div>\n }\n</div>\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n afterNextRender,\n booleanAttribute,\n contentChildren,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Subscription, auditTime, debounceTime, filter, fromEvent, map, take } from 'rxjs';\n\nimport { SdAnchorVerticalListV2 } from '../anchor-vertical-v2/anchor-vertical-list-v2.component';\nimport { SdAnchorItemV2 } from '../anchor-item-v2/anchor-item-v2.component';\n\n@Component({\n selector: 'sd-anchor-v2',\n templateUrl: './anchor-v2.component.html',\n styleUrls: ['./anchor-v2.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, SdAnchorVerticalListV2],\n standalone: true,\n})\nexport class SdAnchorV2 implements OnDestroy {\n wrapper = viewChild.required<ElementRef>('wrapper');\n sections = contentChildren(SdAnchorItemV2);\n\n type = input<'vertical' | 'horizontal'>('vertical');\n sidebarWidth = input<string>('200px');\n ellipsis = input(false, { transform: booleanAttribute });\n isOverscroll = input(false, { transform: booleanAttribute });\n isHiddenAnchorList = input(false, { transform: booleanAttribute });\n\n activeSectionId = signal<string>('');\n\n #scrollSubscription = new Subscription();\n #clickScrollSubscription = new Subscription();\n #delay = 100;\n #currentScrollTop = 0;\n #timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n afterNextRender(() => {\n if (!this.isHiddenAnchorList()) {\n this.activeSectionId.set(this.sections()[0]?.id ?? '');\n this.#registerScrollSubscription();\n }\n });\n }\n\n #registerScrollSubscription = (): void => {\n this.#disposeResources();\n const wrapperEl = this.wrapper().nativeElement;\n this.#scrollSubscription = fromEvent<UIEvent>(wrapperEl, 'scroll')\n .pipe(auditTime(50))\n .subscribe((event: UIEvent) => {\n const el = event.target as HTMLElement;\n this.#currentScrollTop = this.#updateCurrentScroll(el);\n for (const section of this.sections()) {\n const rect = section.elementRef.nativeElement;\n const rectTop = rect.offsetTop;\n const rectBottom = rectTop + rect.offsetHeight;\n if (this.#currentScrollTop >= rectTop && this.#currentScrollTop < rectBottom) {\n this.activeSectionId.set(section.id);\n break;\n }\n }\n });\n };\n\n scrollSectionByClick(idSectionTarget: string): void {\n this.activeSectionId.set(idSectionTarget);\n const targetSection = this.sections().find(s => s.id === idSectionTarget)?.elementRef;\n if (!targetSection) return;\n\n this.#disposeResources();\n const wrapperEl = this.wrapper().nativeElement;\n const targetElement = targetSection.nativeElement;\n const prevScrollTop = this.#currentScrollTop;\n\n this.#clickScrollSubscription = fromEvent<UIEvent>(wrapperEl, 'scroll')\n .pipe(\n auditTime(this.#delay),\n map((event: UIEvent) => {\n const el = event.target as HTMLElement;\n this.#currentScrollTop = this.#updateCurrentScroll(el);\n const wrapperTop = wrapperEl.getBoundingClientRect().top;\n const targetRect = targetElement.getBoundingClientRect();\n const isVisible = targetRect.top >= 0 && targetRect.bottom <= window.innerHeight;\n return Math.abs(targetRect.top - wrapperTop) < 1 || isVisible;\n }),\n filter(Boolean),\n debounceTime(this.#delay + 100),\n take(1)\n )\n .subscribe(() => this.#registerScrollSubscription());\n\n this.#timeoutId = setTimeout(() => {\n if (prevScrollTop === this.#currentScrollTop) {\n this.#registerScrollSubscription();\n }\n }, this.#delay + 100);\n\n wrapperEl.scrollTo({ top: targetElement.offsetTop, behavior: 'smooth' });\n }\n\n #updateCurrentScroll(el: HTMLElement): number {\n const style = getComputedStyle(el);\n return el.scrollTop + parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth);\n }\n\n #disposeResources = (): void => {\n if (this.#timeoutId) clearTimeout(this.#timeoutId);\n this.#scrollSubscription?.unsubscribe();\n this.#clickScrollSubscription?.unsubscribe();\n };\n\n ngOnDestroy(): void {\n this.#disposeResources();\n }\n}\n","<div class=\"c-anchor-vertical\" [ngClass]=\"{ 'c-stop-scroll-propagation': !isOverscroll() }\" #wrapper>\n <div class=\"c-anchor-content\" [style.width]=\"'calc(100% - ' + sidebarWidth() + ' - 16px)'\">\n <ng-content></ng-content>\n </div>\n\n @if (!isHiddenAnchorList()) {\n <div class=\"c-anchor-list\" [style.width]=\"sidebarWidth()\">\n <sd-anchor-vertical-list-v2\n [sections]=\"sections()\"\n [ellipsis]=\"ellipsis()\"\n [sidebarWidth]=\"sidebarWidth()\"\n [activeSectionId]=\"activeSectionId()\"\n (sdClickSection)=\"scrollSectionByClick($event)\">\n </sd-anchor-vertical-list-v2>\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuidv4"],"mappings":";;;;;;;;;MAYa,cAAc,CAAA;AACzB,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;IAChC,IAAI,GAAG,KAAK,EAAsB;IAClC,EAAE,GAAWA,EAAM,EAAE;AACrB,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAE/B,IAAA,WAAA,GAAA;QACE,MAAM,CAAC,MAAK;AACV,YAAA,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE;gBAChB,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC;YACxD;AACF,QAAA,CAAC,CAAC;IACJ;wGAZW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAA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