@acorex/cdk 19.6.2 → 19.7.0-next.1
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/fesm2022/acorex-cdk-list-navigation.mjs +172 -0
- package/fesm2022/acorex-cdk-list-navigation.mjs.map +1 -0
- package/fesm2022/acorex-cdk-outline.mjs +162 -0
- package/fesm2022/acorex-cdk-outline.mjs.map +1 -0
- package/fesm2022/acorex-cdk-pan-view.mjs +175 -0
- package/fesm2022/acorex-cdk-pan-view.mjs.map +1 -0
- package/fesm2022/acorex-cdk-selection.mjs +2 -2
- package/fesm2022/acorex-cdk-selection.mjs.map +1 -1
- package/list-navigation/README.md +3 -0
- package/list-navigation/index.d.ts +3 -0
- package/list-navigation/lib/list-navigation-item.directive.d.ts +13 -0
- package/list-navigation/lib/list-navigation.directive.d.ts +18 -0
- package/list-navigation/lib/list-navigation.module.d.ts +9 -0
- package/outline/README.md +3 -0
- package/outline/index.d.ts +3 -0
- package/outline/lib/outline-container.directive.d.ts +26 -0
- package/outline/lib/outline-item.directive.d.ts +8 -0
- package/outline/lib/outline.module.d.ts +9 -0
- package/package.json +13 -1
- package/pan-view/README.md +3 -0
- package/pan-view/index.d.ts +2 -0
- package/pan-view/lib/pan-view.directive.d.ts +34 -0
- package/pan-view/lib/pan-view.module.d.ts +8 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, signal, afterNextRender, Directive, contentChildren, output, input, effect, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
class AXListNavigationItemDirective {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.itemElem = inject(ElementRef);
|
|
8
|
+
this.isActive = signal(false);
|
|
9
|
+
this.navigationItemKey = Math.random();
|
|
10
|
+
this.navigationParentItemKey = signal(null);
|
|
11
|
+
this.index = signal(null);
|
|
12
|
+
this.parent = inject(AXListNavigationItemDirective, { optional: true, skipSelf: true });
|
|
13
|
+
this.#init = afterNextRender(() => {
|
|
14
|
+
if (!this.parent?.navigationItemKey)
|
|
15
|
+
return;
|
|
16
|
+
this.navigationParentItemKey.set(this.parent.navigationItemKey);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
#init;
|
|
20
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
21
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXListNavigationItemDirective, isStandalone: false, selector: "[axListNavigationItem]", exportAs: ["axListNavigationItem"], ngImport: i0 }); }
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationItemDirective, decorators: [{
|
|
24
|
+
type: Directive,
|
|
25
|
+
args: [{
|
|
26
|
+
selector: '[axListNavigationItem]',
|
|
27
|
+
standalone: false,
|
|
28
|
+
exportAs: 'axListNavigationItem',
|
|
29
|
+
}]
|
|
30
|
+
}] });
|
|
31
|
+
|
|
32
|
+
class AXListNavigationDirective {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.parentElem = inject(ElementRef);
|
|
35
|
+
this.childElem = contentChildren(AXListNavigationItemDirective, { descendants: true });
|
|
36
|
+
this.activeIndex = signal(null);
|
|
37
|
+
this.holdShift = signal(false);
|
|
38
|
+
this.onNavigationChanged = output();
|
|
39
|
+
this.orientation = input('vertical');
|
|
40
|
+
this.#init = afterNextRender(() => {
|
|
41
|
+
this.parentElem.nativeElement.onkeydown = (e) => {
|
|
42
|
+
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
43
|
+
this.holdShift.set(true);
|
|
44
|
+
}
|
|
45
|
+
if (this.orientation() === 'vertical') {
|
|
46
|
+
switch (e.code) {
|
|
47
|
+
case 'ArrowDown':
|
|
48
|
+
this.navigationHandler('ArrowDown');
|
|
49
|
+
break;
|
|
50
|
+
case 'ArrowUp':
|
|
51
|
+
this.navigationHandler('ArrowUp');
|
|
52
|
+
break;
|
|
53
|
+
case 'ArrowLeft':
|
|
54
|
+
this.parentNavigationHandler('ArrowLeft');
|
|
55
|
+
break;
|
|
56
|
+
case 'Tab':
|
|
57
|
+
if (this.holdShift()) {
|
|
58
|
+
this.navigationHandler('ArrowUp');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.navigationHandler('ArrowDown');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (this.orientation() === 'horizontal') {
|
|
66
|
+
switch (e.code) {
|
|
67
|
+
case 'ArrowRight':
|
|
68
|
+
this.navigationHandler('ArrowDown');
|
|
69
|
+
break;
|
|
70
|
+
case 'ArrowLeft':
|
|
71
|
+
this.navigationHandler('ArrowUp');
|
|
72
|
+
break;
|
|
73
|
+
case 'ArrowUp':
|
|
74
|
+
this.parentNavigationHandler('ArrowLeft');
|
|
75
|
+
break;
|
|
76
|
+
case 'Tab':
|
|
77
|
+
if (this.holdShift()) {
|
|
78
|
+
this.navigationHandler('ArrowUp');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.navigationHandler('ArrowDown');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
this.parentElem.nativeElement.onkeyup = (e) => {
|
|
87
|
+
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
88
|
+
this.holdShift.set(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.parentElem.nativeElement.tabIndex = 0;
|
|
92
|
+
this.childElem().forEach((item, index) => {
|
|
93
|
+
item.itemElem.nativeElement.tabIndex = 0;
|
|
94
|
+
item.index.set(index);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
this.#effect = effect(() => {
|
|
98
|
+
if (this.childElem().length === 0 || this.activeIndex() === null)
|
|
99
|
+
return;
|
|
100
|
+
this.childElem()[this.activeIndex()].itemElem.nativeElement.focus();
|
|
101
|
+
this.childElem().forEach((item) => item.isActive.set(false));
|
|
102
|
+
this.childElem()[this.activeIndex()].isActive.set(true);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
#init;
|
|
106
|
+
navigationHandler(e) {
|
|
107
|
+
this.onNavigationChanged.emit({ sender: this });
|
|
108
|
+
if (this.activeIndex() === null) {
|
|
109
|
+
this.activeIndex.set(0);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (e === 'ArrowUp' && this.activeIndex() > 0) {
|
|
113
|
+
this.activeIndex.update((prev) => prev - 1);
|
|
114
|
+
}
|
|
115
|
+
else if (e === 'ArrowDown' && this.activeIndex() < this.childElem().length - 1) {
|
|
116
|
+
this.activeIndex.update((prev) => prev + 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
parentNavigationHandler(e) {
|
|
120
|
+
if (e === 'ArrowLeft') {
|
|
121
|
+
const selectedItemParentKey = this.childElem()[this.activeIndex()].navigationParentItemKey();
|
|
122
|
+
if (!selectedItemParentKey)
|
|
123
|
+
return;
|
|
124
|
+
const parentElem = this.childElem().find((item) => item.navigationItemKey === selectedItemParentKey);
|
|
125
|
+
parentElem.itemElem.nativeElement.focus();
|
|
126
|
+
this.childElem().forEach((item) => item.isActive.set(false));
|
|
127
|
+
parentElem.isActive.set(true);
|
|
128
|
+
this.activeIndex.set(parentElem.index());
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
#effect;
|
|
132
|
+
navigateTo(e) {
|
|
133
|
+
e.itemElem.nativeElement.focus();
|
|
134
|
+
this.childElem().forEach((item) => item.isActive.set(false));
|
|
135
|
+
e.isActive.set(true);
|
|
136
|
+
this.activeIndex.set(e.index());
|
|
137
|
+
}
|
|
138
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
139
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.3", type: AXListNavigationDirective, isStandalone: false, selector: "[axListNavigation]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onNavigationChanged: "onNavigationChanged" }, queries: [{ propertyName: "childElem", predicate: AXListNavigationItemDirective, descendants: true, isSignal: true }], exportAs: ["axListNavigation"], ngImport: i0 }); }
|
|
140
|
+
}
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationDirective, decorators: [{
|
|
142
|
+
type: Directive,
|
|
143
|
+
args: [{
|
|
144
|
+
selector: '[axListNavigation]',
|
|
145
|
+
standalone: false,
|
|
146
|
+
exportAs: 'axListNavigation',
|
|
147
|
+
}]
|
|
148
|
+
}] });
|
|
149
|
+
|
|
150
|
+
const COMPONENT = [AXListNavigationDirective, AXListNavigationItemDirective];
|
|
151
|
+
const MODULES = [CommonModule];
|
|
152
|
+
class AXListNavigationModule {
|
|
153
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
154
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationModule, declarations: [AXListNavigationDirective, AXListNavigationItemDirective], imports: [CommonModule], exports: [AXListNavigationDirective, AXListNavigationItemDirective] }); }
|
|
155
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationModule, imports: [MODULES] }); }
|
|
156
|
+
}
|
|
157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationModule, decorators: [{
|
|
158
|
+
type: NgModule,
|
|
159
|
+
args: [{
|
|
160
|
+
declarations: [...COMPONENT],
|
|
161
|
+
imports: [...MODULES],
|
|
162
|
+
exports: [...COMPONENT],
|
|
163
|
+
providers: [],
|
|
164
|
+
}]
|
|
165
|
+
}] });
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Generated bundle index. Do not edit.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
export { AXListNavigationDirective, AXListNavigationItemDirective, AXListNavigationModule };
|
|
172
|
+
//# sourceMappingURL=acorex-cdk-list-navigation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-cdk-list-navigation.mjs","sources":["../../../../libs/cdk/list-navigation/src/lib/list-navigation-item.directive.ts","../../../../libs/cdk/list-navigation/src/lib/list-navigation.directive.ts","../../../../libs/cdk/list-navigation/src/lib/list-navigation.module.ts","../../../../libs/cdk/list-navigation/src/acorex-cdk-list-navigation.ts"],"sourcesContent":["import { afterNextRender, Directive, ElementRef, inject, signal } from '@angular/core';\n\n@Directive({\n selector: '[axListNavigationItem]',\n standalone: false,\n exportAs: 'axListNavigationItem',\n})\nexport class AXListNavigationItemDirective {\n itemElem = inject(ElementRef);\n isActive = signal(false);\n navigationItemKey = Math.random();\n navigationParentItemKey = signal(null);\n index = signal(null);\n\n private parent = inject(AXListNavigationItemDirective, { optional: true, skipSelf: true });\n\n #init = afterNextRender(() => {\n if (!this.parent?.navigationItemKey) return;\n this.navigationParentItemKey.set(this.parent.navigationItemKey);\n });\n}\n","import {\n afterNextRender,\n contentChildren,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { AXListNavigationItemDirective } from './list-navigation-item.directive';\n\n@Directive({\n selector: '[axListNavigation]',\n standalone: false,\n exportAs: 'axListNavigation',\n})\nexport class AXListNavigationDirective {\n private parentElem = inject(ElementRef);\n private childElem = contentChildren(AXListNavigationItemDirective, { descendants: true });\n private activeIndex = signal(null);\n private holdShift = signal(false);\n onNavigationChanged = output<{ sender: AXListNavigationDirective }>();\n orientation = input<'horizontal' | 'vertical'>('vertical');\n\n #init = afterNextRender(() => {\n (this.parentElem.nativeElement as HTMLElement).onkeydown = (e: KeyboardEvent) => {\n if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {\n this.holdShift.set(true);\n }\n\n if (this.orientation() === 'vertical') {\n switch (e.code) {\n case 'ArrowDown':\n this.navigationHandler('ArrowDown');\n break;\n case 'ArrowUp':\n this.navigationHandler('ArrowUp');\n break;\n case 'ArrowLeft':\n this.parentNavigationHandler('ArrowLeft');\n break;\n case 'Tab':\n if (this.holdShift()) {\n this.navigationHandler('ArrowUp');\n } else {\n this.navigationHandler('ArrowDown');\n }\n }\n } else if (this.orientation() === 'horizontal') {\n switch (e.code) {\n case 'ArrowRight':\n this.navigationHandler('ArrowDown');\n break;\n case 'ArrowLeft':\n this.navigationHandler('ArrowUp');\n break;\n case 'ArrowUp':\n this.parentNavigationHandler('ArrowLeft');\n break;\n case 'Tab':\n if (this.holdShift()) {\n this.navigationHandler('ArrowUp');\n } else {\n this.navigationHandler('ArrowDown');\n }\n }\n }\n };\n\n (this.parentElem.nativeElement as HTMLElement).onkeyup = (e: KeyboardEvent) => {\n if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {\n this.holdShift.set(false);\n }\n };\n\n (this.parentElem.nativeElement as HTMLElement).tabIndex = 0;\n this.childElem().forEach((item, index) => {\n (item.itemElem.nativeElement as HTMLElement).tabIndex = 0;\n item.index.set(index);\n });\n });\n\n private navigationHandler(e: string) {\n this.onNavigationChanged.emit({ sender: this });\n\n if (this.activeIndex() === null) {\n this.activeIndex.set(0);\n return;\n }\n\n if (e === 'ArrowUp' && this.activeIndex() > 0) {\n this.activeIndex.update((prev) => prev - 1);\n } else if (e === 'ArrowDown' && this.activeIndex() < this.childElem().length - 1) {\n this.activeIndex.update((prev) => prev + 1);\n }\n }\n\n private parentNavigationHandler(e: string) {\n if (e === 'ArrowLeft') {\n const selectedItemParentKey = this.childElem()[this.activeIndex()].navigationParentItemKey();\n if (!selectedItemParentKey) return;\n const parentElem = this.childElem().find((item) => item.navigationItemKey === selectedItemParentKey);\n (parentElem.itemElem.nativeElement as HTMLAreaElement).focus();\n this.childElem().forEach((item) => item.isActive.set(false));\n parentElem.isActive.set(true);\n this.activeIndex.set(parentElem.index());\n }\n }\n\n #effect = effect(() => {\n if (this.childElem().length === 0 || this.activeIndex() === null) return;\n (this.childElem()[this.activeIndex()].itemElem.nativeElement as HTMLElement).focus();\n this.childElem().forEach((item) => item.isActive.set(false));\n this.childElem()[this.activeIndex()].isActive.set(true);\n });\n\n navigateTo(e: AXListNavigationItemDirective) {\n (e.itemElem.nativeElement as HTMLElement).focus();\n this.childElem().forEach((item) => item.isActive.set(false));\n e.isActive.set(true);\n this.activeIndex.set(e.index());\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXListNavigationItemDirective } from './list-navigation-item.directive';\nimport { AXListNavigationDirective } from './list-navigation.directive';\n\nconst COMPONENT = [AXListNavigationDirective, AXListNavigationItemDirective];\n\nconst MODULES = [CommonModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXListNavigationModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAOa,6BAA6B,CAAA;AAL1C,IAAA,WAAA,GAAA;AAME,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;AAC7B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;AACxB,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,CAAC,MAAM,EAAE;AACjC,QAAA,IAAA,CAAA,uBAAuB,GAAG,MAAM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,yBAAyB,EAAE,6BAA6B,CAAC;AAE5E,MAAM,OAAO,GAAG,CAAC,YAAY,CAAC;MAQjB,sBAAsB,CAAA;8GAAtB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAtB,sBAAsB,EAAA,YAAA,EAAA,CAVhB,yBAAyB,EAAE,6BAA6B,aAE1D,YAAY,CAAA,EAAA,OAAA,EAAA,CAFV,yBAAyB,EAAE,6BAA6B,CAAA,EAAA,CAAA,CAAA;AAU9D,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,YAJpB,OAAO,CAAA,EAAA,CAAA,CAAA;;2FAIT,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBANlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { AXUnsubscriber } from '@acorex/core/utils';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, NgZone, ElementRef, input, signal, afterNextRender, Directive, NgModule } from '@angular/core';
|
|
4
|
+
import { Router, NavigationEnd } from '@angular/router';
|
|
5
|
+
import { BehaviorSubject, fromEvent, map } from 'rxjs';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
class AXOutlineContainerDirective {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.router = inject(Router);
|
|
11
|
+
this.zone = inject(NgZone);
|
|
12
|
+
this.el = inject((ElementRef));
|
|
13
|
+
this.unsubscriber = inject(AXUnsubscriber);
|
|
14
|
+
this.target = input();
|
|
15
|
+
this.smoothScroll = input(true);
|
|
16
|
+
this.activationOffset = input(16);
|
|
17
|
+
this.activateLastAtBottom = input(true);
|
|
18
|
+
this.scrollTop = signal(0);
|
|
19
|
+
this.outlineItems = signal([]);
|
|
20
|
+
this.outlineItems$ = new BehaviorSubject([]);
|
|
21
|
+
this.#anr = afterNextRender(() => {
|
|
22
|
+
if (this.smoothScroll) {
|
|
23
|
+
this.el.nativeElement.style.scrollBehavior = 'smooth';
|
|
24
|
+
}
|
|
25
|
+
this.setOutlineItems();
|
|
26
|
+
this.router.events.pipe(this.unsubscriber.takeUntilDestroy).subscribe((e) => {
|
|
27
|
+
if (e instanceof NavigationEnd) {
|
|
28
|
+
this.setOutlineItems();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
this.zone.runOutsideAngular(() => {
|
|
32
|
+
fromEvent(this.el.nativeElement, 'scroll')
|
|
33
|
+
.pipe(this.unsubscriber.takeUntilDestroy, map(() => this.el.nativeElement.scrollTop))
|
|
34
|
+
.subscribe((scrollTop) => {
|
|
35
|
+
this.scrollTop.set(scrollTop);
|
|
36
|
+
this.scrollChanged(scrollTop);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
#anr;
|
|
42
|
+
scrollChanged(scrollTop) {
|
|
43
|
+
this.outlineItems.update((prevItems) => {
|
|
44
|
+
if (prevItems.length === 0)
|
|
45
|
+
return prevItems;
|
|
46
|
+
const scrollHeight = this.el.nativeElement.scrollHeight;
|
|
47
|
+
const clientHeight = this.el.nativeElement.clientHeight;
|
|
48
|
+
const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
|
|
49
|
+
if (isAtBottom && this.activateLastAtBottom()) {
|
|
50
|
+
return prevItems.map((item, index) => ({
|
|
51
|
+
...item,
|
|
52
|
+
active: index === prevItems.length - 1,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
let activeIndex = -1;
|
|
56
|
+
for (let i = 0; i < prevItems.length; i++) {
|
|
57
|
+
const item = prevItems[i];
|
|
58
|
+
if (scrollTop >= item.scrollY - this.activationOffset()) {
|
|
59
|
+
activeIndex = i;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return prevItems.map((item, index) => ({
|
|
63
|
+
...item,
|
|
64
|
+
active: index === activeIndex,
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
this.outlineItems$.next(this.outlineItems());
|
|
68
|
+
}
|
|
69
|
+
setOutlineItems() {
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
const targets = this.target() ? [...this.el.nativeElement.querySelectorAll(this.target())] : [];
|
|
72
|
+
targets.push(...this.el.nativeElement.querySelectorAll('[data-ax-outline-item="true"]'));
|
|
73
|
+
const uniqueTargets = new Set(targets);
|
|
74
|
+
const outlineItems = Array.from(uniqueTargets)
|
|
75
|
+
.map((el) => {
|
|
76
|
+
const existingId = el.id;
|
|
77
|
+
let newId;
|
|
78
|
+
if (!existingId) {
|
|
79
|
+
const textContent = el.textContent.trim();
|
|
80
|
+
if (textContent) {
|
|
81
|
+
newId = `${textContent.replace(/\s+/g, '-')}`;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
newId = `${Math.random().toString(36).slice(2, 7)}`;
|
|
85
|
+
}
|
|
86
|
+
el.id = newId;
|
|
87
|
+
}
|
|
88
|
+
return { el, active: false, scrollY: el.offsetTop };
|
|
89
|
+
})
|
|
90
|
+
.sort((a, b) => a.scrollY - b.scrollY);
|
|
91
|
+
this.outlineItems.set(outlineItems);
|
|
92
|
+
this.scrollChanged(this.scrollTop());
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
96
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: AXOutlineContainerDirective, isStandalone: false, selector: "[axOutlineContainer]", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, smoothScroll: { classPropertyName: "smoothScroll", publicName: "smoothScroll", isSignal: true, isRequired: false, transformFunction: null }, activationOffset: { classPropertyName: "activationOffset", publicName: "activationOffset", isSignal: true, isRequired: false, transformFunction: null }, activateLastAtBottom: { classPropertyName: "activateLastAtBottom", publicName: "activateLastAtBottom", isSignal: true, isRequired: false, transformFunction: null } }, providers: [AXUnsubscriber], exportAs: ["axOutlineContainer"], ngImport: i0 }); }
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineContainerDirective, decorators: [{
|
|
99
|
+
type: Directive,
|
|
100
|
+
args: [{
|
|
101
|
+
selector: '[axOutlineContainer]',
|
|
102
|
+
standalone: false,
|
|
103
|
+
exportAs: 'axOutlineContainer',
|
|
104
|
+
providers: [AXUnsubscriber],
|
|
105
|
+
}]
|
|
106
|
+
}] });
|
|
107
|
+
|
|
108
|
+
class AXOutlineItemDirective {
|
|
109
|
+
constructor() {
|
|
110
|
+
this.el = inject(ElementRef);
|
|
111
|
+
this.id = input();
|
|
112
|
+
this.#anr = afterNextRender(() => {
|
|
113
|
+
this.el.nativeElement.dataset['axOutlineItem'] = 'true';
|
|
114
|
+
let newId;
|
|
115
|
+
if (!this.id()) {
|
|
116
|
+
const textContent = this.el.nativeElement.textContent.trim();
|
|
117
|
+
if (textContent) {
|
|
118
|
+
newId = `${textContent.replace(/\s+/g, '-')}`;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
newId = `${Math.random().toString(36).slice(2, 7)}`;
|
|
122
|
+
}
|
|
123
|
+
this.el.nativeElement.id = newId;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
#anr;
|
|
128
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
129
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: AXOutlineItemDirective, isStandalone: false, selector: "[axOutlineItem]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["axOutlineItem"], ngImport: i0 }); }
|
|
130
|
+
}
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineItemDirective, decorators: [{
|
|
132
|
+
type: Directive,
|
|
133
|
+
args: [{
|
|
134
|
+
selector: '[axOutlineItem]',
|
|
135
|
+
exportAs: 'axOutlineItem',
|
|
136
|
+
standalone: false,
|
|
137
|
+
}]
|
|
138
|
+
}] });
|
|
139
|
+
|
|
140
|
+
const COMPONENT = [AXOutlineContainerDirective, AXOutlineItemDirective];
|
|
141
|
+
const MODULES = [CommonModule];
|
|
142
|
+
class AXOutlineModule {
|
|
143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
144
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineModule, declarations: [AXOutlineContainerDirective, AXOutlineItemDirective], imports: [CommonModule], exports: [AXOutlineContainerDirective, AXOutlineItemDirective] }); }
|
|
145
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineModule, imports: [MODULES] }); }
|
|
146
|
+
}
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXOutlineModule, decorators: [{
|
|
148
|
+
type: NgModule,
|
|
149
|
+
args: [{
|
|
150
|
+
declarations: [...COMPONENT],
|
|
151
|
+
imports: [...MODULES],
|
|
152
|
+
exports: [...COMPONENT],
|
|
153
|
+
providers: [],
|
|
154
|
+
}]
|
|
155
|
+
}] });
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Generated bundle index. Do not edit.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
export { AXOutlineContainerDirective, AXOutlineItemDirective, AXOutlineModule };
|
|
162
|
+
//# sourceMappingURL=acorex-cdk-outline.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-cdk-outline.mjs","sources":["../../../../libs/cdk/outline/src/lib/outline-container.directive.ts","../../../../libs/cdk/outline/src/lib/outline-item.directive.ts","../../../../libs/cdk/outline/src/lib/outline.module.ts","../../../../libs/cdk/outline/src/acorex-cdk-outline.ts"],"sourcesContent":["import { AXUnsubscriber } from '@acorex/core/utils';\nimport { afterNextRender, Directive, ElementRef, inject, input, NgZone, signal } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { BehaviorSubject, fromEvent, map } from 'rxjs';\n\nexport type outlineItemType = { el: HTMLElement; active: boolean; scrollY: number };\n\n@Directive({\n selector: '[axOutlineContainer]',\n standalone: false,\n exportAs: 'axOutlineContainer',\n providers: [AXUnsubscriber],\n})\nexport class AXOutlineContainerDirective {\n router = inject(Router);\n private zone = inject(NgZone);\n private el = inject(ElementRef<HTMLElement>);\n private unsubscriber = inject(AXUnsubscriber);\n\n target = input<string>();\n smoothScroll = input(true);\n activationOffset = input(16);\n activateLastAtBottom = input(true);\n\n private scrollTop = signal(0);\n private outlineItems = signal<outlineItemType[]>([]);\n\n outlineItems$ = new BehaviorSubject<outlineItemType[]>([]);\n\n #anr = afterNextRender(() => {\n if (this.smoothScroll) {\n (this.el.nativeElement as HTMLElement).style.scrollBehavior = 'smooth';\n }\n this.setOutlineItems();\n this.router.events.pipe(this.unsubscriber.takeUntilDestroy).subscribe((e) => {\n if (e instanceof NavigationEnd) {\n this.setOutlineItems();\n }\n });\n this.zone.runOutsideAngular(() => {\n fromEvent(this.el.nativeElement, 'scroll')\n .pipe(\n this.unsubscriber.takeUntilDestroy,\n map(() => this.el.nativeElement.scrollTop),\n )\n .subscribe((scrollTop) => {\n this.scrollTop.set(scrollTop);\n this.scrollChanged(scrollTop);\n });\n });\n });\n\n private scrollChanged(scrollTop: number) {\n this.outlineItems.update((prevItems) => {\n if (prevItems.length === 0) return prevItems;\n\n const scrollHeight = this.el.nativeElement.scrollHeight;\n const clientHeight = this.el.nativeElement.clientHeight;\n const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;\n\n if (isAtBottom && this.activateLastAtBottom()) {\n return prevItems.map((item, index) => ({\n ...item,\n active: index === prevItems.length - 1,\n }));\n }\n\n let activeIndex = -1;\n for (let i = 0; i < prevItems.length; i++) {\n const item = prevItems[i];\n if (scrollTop >= item.scrollY - this.activationOffset()) {\n activeIndex = i;\n }\n }\n return prevItems.map((item, index) => ({\n ...item,\n active: index === activeIndex,\n }));\n });\n this.outlineItems$.next(this.outlineItems());\n }\n\n private setOutlineItems() {\n setTimeout(() => {\n const targets = this.target() ? [...this.el.nativeElement.querySelectorAll(this.target())] : [];\n targets.push(...this.el.nativeElement.querySelectorAll('[data-ax-outline-item=\"true\"]'));\n const uniqueTargets = new Set(targets);\n const outlineItems = Array.from(uniqueTargets)\n .map((el) => {\n const existingId = el.id;\n let newId;\n if (!existingId) {\n const textContent = el.textContent.trim();\n if (textContent) {\n newId = `${textContent.replace(/\\s+/g, '-')}`;\n } else {\n newId = `${Math.random().toString(36).slice(2, 7)}`;\n }\n el.id = newId;\n }\n return { el, active: false, scrollY: el.offsetTop };\n })\n .sort((a, b) => a.scrollY - b.scrollY);\n this.outlineItems.set(outlineItems);\n this.scrollChanged(this.scrollTop());\n });\n }\n}\n","import { afterNextRender, Directive, ElementRef, inject, input } from '@angular/core';\n\n@Directive({\n selector: '[axOutlineItem]',\n exportAs: 'axOutlineItem',\n standalone: false,\n})\nexport class AXOutlineItemDirective {\n private el = inject(ElementRef);\n id = input<string>();\n #anr = afterNextRender(() => {\n (this.el.nativeElement as HTMLElement).dataset['axOutlineItem'] = 'true';\n\n let newId;\n if (!this.id()) {\n const textContent = this.el.nativeElement.textContent.trim();\n if (textContent) {\n newId = `${textContent.replace(/\\s+/g, '-')}`;\n } else {\n newId = `${Math.random().toString(36).slice(2, 7)}`;\n }\n this.el.nativeElement.id = newId;\n }\n });\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXOutlineContainerDirective } from './outline-container.directive';\nimport { AXOutlineItemDirective } from './outline-item.directive';\n\nconst COMPONENT = [AXOutlineContainerDirective, AXOutlineItemDirective];\nconst MODULES = [CommonModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXOutlineModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAaa,2BAA2B,CAAA;AANxC,IAAA,WAAA,GAAA;AAOE,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACf,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AACpC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;QAE7C,IAAM,CAAA,MAAA,GAAG,KAAK,EAAU;AACxB,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC;AAC1B,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAC,EAAE,CAAC;AAC5B,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AiB;AAC3B,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,UAAU,EAAE,KAAK;AAClB,iBAAA;;;ACDD,MAAM,SAAS,GAAG,CAAC,2BAA2B,EAAE,sBAAsB,CAAC;AACvE,MAAM,OAAO,GAAG,CAAC,YAAY,CAAC;MAQjB,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,YAAA,EAAA,CATT,2BAA2B,EAAE,sBAAsB,aACrD,YAAY,CAAA,EAAA,OAAA,EAAA,CADV,2BAA2B,EAAE,sBAAsB,CAAA,EAAA,CAAA,CAAA;AASzD,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAJb,OAAO,CAAA,EAAA,CAAA,CAAA;;2FAIT,eAAe,EAAA,UAAA,EAAA,CAAA;kBAN3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, NgZone, Renderer2, ElementRef, signal, input, model, output, computed, effect, afterNextRender, Directive, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
class AXPanViewDirective {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.zone = inject(NgZone);
|
|
8
|
+
this.render = inject(Renderer2);
|
|
9
|
+
this.el = inject((ElementRef));
|
|
10
|
+
this.prevX = signal(0);
|
|
11
|
+
this.prevY = signal(0);
|
|
12
|
+
this.pointerDown = signal(false);
|
|
13
|
+
this.wrapper = signal(null);
|
|
14
|
+
this.zoomStep = input(7);
|
|
15
|
+
this.minZoom = input(25);
|
|
16
|
+
this.maxZoom = input(400);
|
|
17
|
+
this.disablePan = input(false);
|
|
18
|
+
this.disableZoom = input(false);
|
|
19
|
+
this.wrapperClasses = input('');
|
|
20
|
+
this.panX = model(0);
|
|
21
|
+
this.panY = model(0);
|
|
22
|
+
this.zoom = model(100);
|
|
23
|
+
this.zoomChange = output();
|
|
24
|
+
this.positionChange = output();
|
|
25
|
+
this.nativeEl = computed(() => this.el.nativeElement);
|
|
26
|
+
this.zoomValue = computed(() => {
|
|
27
|
+
const zoomLevel = Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom()));
|
|
28
|
+
return zoomLevel / 100;
|
|
29
|
+
});
|
|
30
|
+
this.#zoomChange = effect(() => {
|
|
31
|
+
const zoomLevel = Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom()));
|
|
32
|
+
this.zoomChange.emit(zoomLevel);
|
|
33
|
+
this.nativeEl().style.scale = this.zoomValue().toString();
|
|
34
|
+
});
|
|
35
|
+
this.#positionChange = effect(() => {
|
|
36
|
+
this.nativeEl().style.transform = `translate(${this.panX()}px, ${this.panY()}px)`;
|
|
37
|
+
this.positionChange.emit({ x: this.panX(), y: this.panY() });
|
|
38
|
+
});
|
|
39
|
+
this.#anr = afterNextRender(() => {
|
|
40
|
+
// Create Wrapper
|
|
41
|
+
this.createWrapper();
|
|
42
|
+
// Wheel Event
|
|
43
|
+
this.render.listen(this.wrapper(), 'wheel', (e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
if (e.ctrlKey) {
|
|
46
|
+
this.handleZoomChange(e);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
else if (e.shiftKey) {
|
|
50
|
+
if (this.disablePan())
|
|
51
|
+
return;
|
|
52
|
+
this.panX.update((prev) => prev - e.deltaY / 3);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if (this.disablePan())
|
|
56
|
+
return;
|
|
57
|
+
this.panY.update((prev) => prev - e.deltaY / 3);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
// Pointer Down Event
|
|
61
|
+
this.zone.runOutsideAngular(() => {
|
|
62
|
+
this.render.listen(this.wrapper(), 'pointerdown', (e) => {
|
|
63
|
+
this.handlePointerDown(e);
|
|
64
|
+
});
|
|
65
|
+
// Pointer Move Event
|
|
66
|
+
this.render.listen(this.wrapper(), 'pointermove', (e) => {
|
|
67
|
+
this.handlePointerMove(e);
|
|
68
|
+
});
|
|
69
|
+
// Pointer Up/Leave Event
|
|
70
|
+
this.render.listen(this.wrapper(), 'pointerup', (e) => {
|
|
71
|
+
this.handlePointerUp(e);
|
|
72
|
+
});
|
|
73
|
+
this.render.listen(this.wrapper(), 'pointerleave', (e) => {
|
|
74
|
+
this.handlePointerUp(e);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
#zoomChange;
|
|
80
|
+
#positionChange;
|
|
81
|
+
#anr;
|
|
82
|
+
handleZoomChange(e) {
|
|
83
|
+
if (this.disableZoom())
|
|
84
|
+
return;
|
|
85
|
+
if (e.deltaY > 0) {
|
|
86
|
+
this.zoom.update((prev) => Math.min(this.maxZoom(), prev - this.zoomStep()));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.zoom.update((prev) => Math.max(this.minZoom(), prev + this.zoomStep()));
|
|
90
|
+
}
|
|
91
|
+
createWrapper() {
|
|
92
|
+
this.wrapper.set(this.render.createElement('div'));
|
|
93
|
+
this.render.addClass(this.wrapper(), 'ax-pan-view-wrapper');
|
|
94
|
+
this.render.addClass(this.wrapper(), this.wrapperClasses());
|
|
95
|
+
const parent = this.nativeEl().parentNode;
|
|
96
|
+
this.render.appendChild(this.wrapper(), this.nativeEl());
|
|
97
|
+
this.render.insertBefore(parent, this.wrapper(), this.nativeEl().nextSibling);
|
|
98
|
+
this.render.setStyle(this.wrapper(), 'width', '100%');
|
|
99
|
+
this.render.setStyle(this.wrapper(), 'height', '100%');
|
|
100
|
+
this.render.setStyle(this.wrapper(), 'overflow', 'hidden');
|
|
101
|
+
this.render.setStyle(this.wrapper(), 'position', 'relative');
|
|
102
|
+
this.render.setStyle(this.nativeEl(), 'top', '0');
|
|
103
|
+
this.render.setStyle(this.nativeEl(), 'left', '0');
|
|
104
|
+
this.render.setStyle(this.nativeEl(), 'width', '100%');
|
|
105
|
+
this.render.setStyle(this.nativeEl(), 'position', 'absolute');
|
|
106
|
+
}
|
|
107
|
+
handlePointerDown(e) {
|
|
108
|
+
if (this.disablePan())
|
|
109
|
+
return;
|
|
110
|
+
if ((e.pointerType === 'mouse' && e.buttons === 4) || e.pointerType !== 'mouse') {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
this.pointerDown.set(true);
|
|
113
|
+
this.wrapper().style.cursor = 'grabbing';
|
|
114
|
+
// Update previous position for next move
|
|
115
|
+
const currentX = e.clientX;
|
|
116
|
+
const currentY = e.clientY;
|
|
117
|
+
this.prevX.set(currentX);
|
|
118
|
+
this.prevY.set(currentY);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
handlePointerMove(e) {
|
|
122
|
+
if (this.pointerDown() && !this.disablePan()) {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
const currentX = e.clientX;
|
|
125
|
+
const currentY = e.clientY;
|
|
126
|
+
const deltaX = currentX - this.prevX();
|
|
127
|
+
const deltaY = currentY - this.prevY();
|
|
128
|
+
this.panX.update((prev) => prev + deltaX / this.zoomValue());
|
|
129
|
+
this.panY.update((prev) => prev + deltaY / this.zoomValue());
|
|
130
|
+
this.prevX.set(currentX);
|
|
131
|
+
this.prevY.set(currentY);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
handlePointerUp(e) {
|
|
135
|
+
if (this.pointerDown() && !this.disablePan()) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
this.pointerDown.set(false);
|
|
138
|
+
this.wrapper().style.cursor = 'auto';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPanViewDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
142
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: AXPanViewDirective, isStandalone: false, selector: "[axPanView]", inputs: { zoomStep: { classPropertyName: "zoomStep", publicName: "zoomStep", isSignal: true, isRequired: false, transformFunction: null }, minZoom: { classPropertyName: "minZoom", publicName: "minZoom", isSignal: true, isRequired: false, transformFunction: null }, maxZoom: { classPropertyName: "maxZoom", publicName: "maxZoom", isSignal: true, isRequired: false, transformFunction: null }, disablePan: { classPropertyName: "disablePan", publicName: "disablePan", isSignal: true, isRequired: false, transformFunction: null }, disableZoom: { classPropertyName: "disableZoom", publicName: "disableZoom", isSignal: true, isRequired: false, transformFunction: null }, wrapperClasses: { classPropertyName: "wrapperClasses", publicName: "wrapperClasses", isSignal: true, isRequired: false, transformFunction: null }, panX: { classPropertyName: "panX", publicName: "panX", isSignal: true, isRequired: false, transformFunction: null }, panY: { classPropertyName: "panY", publicName: "panY", isSignal: true, isRequired: false, transformFunction: null }, zoom: { classPropertyName: "zoom", publicName: "zoom", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { panX: "panXChange", panY: "panYChange", zoom: "zoomChange", zoomChange: "zoomChange", positionChange: "positionChange" }, exportAs: ["axPanView"], ngImport: i0 }); }
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPanViewDirective, decorators: [{
|
|
145
|
+
type: Directive,
|
|
146
|
+
args: [{
|
|
147
|
+
selector: '[axPanView]',
|
|
148
|
+
exportAs: 'axPanView',
|
|
149
|
+
standalone: false,
|
|
150
|
+
}]
|
|
151
|
+
}] });
|
|
152
|
+
|
|
153
|
+
const COMPONENT = [AXPanViewDirective];
|
|
154
|
+
const MODULES = [CommonModule];
|
|
155
|
+
class AXPanViewModule {
|
|
156
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPanViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
157
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXPanViewModule, declarations: [AXPanViewDirective], imports: [CommonModule], exports: [AXPanViewDirective] }); }
|
|
158
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPanViewModule, imports: [MODULES] }); }
|
|
159
|
+
}
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPanViewModule, decorators: [{
|
|
161
|
+
type: NgModule,
|
|
162
|
+
args: [{
|
|
163
|
+
declarations: [...COMPONENT],
|
|
164
|
+
imports: [...MODULES],
|
|
165
|
+
exports: [...COMPONENT],
|
|
166
|
+
providers: [],
|
|
167
|
+
}]
|
|
168
|
+
}] });
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Generated bundle index. Do not edit.
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
export { AXPanViewDirective, AXPanViewModule };
|
|
175
|
+
//# sourceMappingURL=acorex-cdk-pan-view.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-cdk-pan-view.mjs","sources":["../../../../libs/cdk/pan-view/src/lib/pan-view.directive.ts","../../../../libs/cdk/pan-view/src/lib/pan-view.module.ts","../../../../libs/cdk/pan-view/src/acorex-cdk-pan-view.ts"],"sourcesContent":["import {\n afterNextRender,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n NgZone,\n output,\n Renderer2,\n signal,\n} from '@angular/core';\n\n@Directive({\n selector: '[axPanView]',\n exportAs: 'axPanView',\n standalone: false,\n})\nexport class AXPanViewDirective {\n private zone = inject(NgZone);\n private render = inject(Renderer2);\n private el = inject(ElementRef<HTMLElement>);\n\n private prevX = signal(0);\n private prevY = signal(0);\n private pointerDown = signal(false);\n private wrapper = signal<HTMLDivElement | null>(null);\n\n zoomStep = input(7);\n minZoom = input(25);\n maxZoom = input(400);\n disablePan = input(false);\n disableZoom = input(false);\n wrapperClasses = input('');\n\n panX = model(0);\n panY = model(0);\n zoom = model(100);\n\n zoomChange = output<number>();\n positionChange = output<{ x: number; y: number }>();\n\n private nativeEl = computed(() => this.el.nativeElement as HTMLElement);\n private zoomValue = computed(() => {\n const zoomLevel = Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom()));\n return zoomLevel / 100;\n });\n\n #zoomChange = effect(() => {\n const zoomLevel = Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom()));\n this.zoomChange.emit(zoomLevel);\n this.nativeEl().style.scale = this.zoomValue().toString();\n });\n #positionChange = effect(() => {\n this.nativeEl().style.transform = `translate(${this.panX()}px, ${this.panY()}px)`;\n this.positionChange.emit({ x: this.panX(), y: this.panY() });\n });\n #anr = afterNextRender(() => {\n // Create Wrapper\n this.createWrapper();\n // Wheel Event\n this.render.listen(this.wrapper(), 'wheel', (e: WheelEvent) => {\n e.preventDefault();\n if (e.ctrlKey) {\n this.handleZoomChange(e);\n return;\n } else if (e.shiftKey) {\n if (this.disablePan()) return;\n this.panX.update((prev) => prev - e.deltaY / 3);\n } else {\n if (this.disablePan()) return;\n this.panY.update((prev) => prev - e.deltaY / 3);\n }\n });\n // Pointer Down Event\n this.zone.runOutsideAngular(() => {\n this.render.listen(this.wrapper(), 'pointerdown', (e: PointerEvent) => {\n this.handlePointerDown(e);\n });\n // Pointer Move Event\n this.render.listen(this.wrapper(), 'pointermove', (e: PointerEvent) => {\n this.handlePointerMove(e);\n });\n // Pointer Up/Leave Event\n this.render.listen(this.wrapper(), 'pointerup', (e: PointerEvent) => {\n this.handlePointerUp(e);\n });\n this.render.listen(this.wrapper(), 'pointerleave', (e: PointerEvent) => {\n this.handlePointerUp(e);\n });\n });\n });\n\n private handleZoomChange(e: WheelEvent) {\n if (this.disableZoom()) return;\n if (e.deltaY > 0) {\n this.zoom.update((prev) => Math.min(this.maxZoom(), prev - this.zoomStep()));\n return;\n }\n this.zoom.update((prev) => Math.max(this.minZoom(), prev + this.zoomStep()));\n }\n\n private createWrapper() {\n this.wrapper.set(this.render.createElement('div'));\n this.render.addClass(this.wrapper(), 'ax-pan-view-wrapper');\n this.render.addClass(this.wrapper(), this.wrapperClasses());\n\n const parent = this.nativeEl().parentNode;\n this.render.appendChild(this.wrapper(), this.nativeEl());\n this.render.insertBefore(parent, this.wrapper(), this.nativeEl().nextSibling);\n\n this.render.setStyle(this.wrapper(), 'width', '100%');\n this.render.setStyle(this.wrapper(), 'height', '100%');\n this.render.setStyle(this.wrapper(), 'overflow', 'hidden');\n this.render.setStyle(this.wrapper(), 'position', 'relative');\n\n this.render.setStyle(this.nativeEl(), 'top', '0');\n this.render.setStyle(this.nativeEl(), 'left', '0');\n this.render.setStyle(this.nativeEl(), 'width', '100%');\n this.render.setStyle(this.nativeEl(), 'position', 'absolute');\n }\n\n private handlePointerDown(e: PointerEvent) {\n if (this.disablePan()) return;\n if ((e.pointerType === 'mouse' && e.buttons === 4) || e.pointerType !== 'mouse') {\n e.preventDefault();\n this.pointerDown.set(true);\n this.wrapper().style.cursor = 'grabbing';\n\n // Update previous position for next move\n const currentX = e.clientX;\n const currentY = e.clientY;\n this.prevX.set(currentX);\n this.prevY.set(currentY);\n }\n }\n\n private handlePointerMove(e: PointerEvent) {\n if (this.pointerDown() && !this.disablePan()) {\n e.preventDefault();\n const currentX = e.clientX;\n const currentY = e.clientY;\n const deltaX = currentX - this.prevX();\n const deltaY = currentY - this.prevY();\n this.panX.update((prev) => prev + deltaX / this.zoomValue());\n this.panY.update((prev) => prev + deltaY / this.zoomValue());\n this.prevX.set(currentX);\n this.prevY.set(currentY);\n }\n }\n\n private handlePointerUp(e: PointerEvent) {\n if (this.pointerDown() && !this.disablePan()) {\n e.preventDefault();\n this.pointerDown.set(false);\n this.wrapper().style.cursor = 'auto';\n }\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXPanViewDirective } from './pan-view.directive';\n\nconst COMPONENT = [AXPanViewDirective];\nconst MODULES = [CommonModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXPanViewModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAoBa,kBAAkB,CAAA;AAL/B,IAAA,WAAA,GAAA;AAMU,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;AAC1B,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AAEpC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AACjB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AACjB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC;AAC3B,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAwB,IAAI,CAAC;AAErD,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC;AACnB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;AACnB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,GAAG,CA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;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,UAAU,EAAE,KAAK;AAClB,iBAAA;;;ACfD,MAAM,SAAS,GAAG,CAAC,kBAAkB,CAAC;AACtC,MAAM,OAAO,GAAG,CAAC,YAAY,CAAC;MAQjB,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,EATT,YAAA,EAAA,CAAA,kBAAkB,CACpB,EAAA,OAAA,EAAA,CAAA,YAAY,aADV,kBAAkB,CAAA,EAAA,CAAA,CAAA;AASxB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAJb,OAAO,CAAA,EAAA,CAAA,CAAA;;2FAIT,eAAe,EAAA,UAAA,EAAA,CAAA;kBAN3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -38,7 +38,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
38
38
|
|
|
39
39
|
class AXSelectionGroupDirective {
|
|
40
40
|
constructor() {
|
|
41
|
-
this.content = contentChildren(AXSelectionItemDirective);
|
|
41
|
+
this.content = contentChildren(AXSelectionItemDirective, { descendants: true });
|
|
42
42
|
this.activeIndex = signal(null);
|
|
43
43
|
this.multiple = input(false);
|
|
44
44
|
this.selectedKeys = input();
|
|
@@ -107,7 +107,7 @@ class AXSelectionGroupDirective {
|
|
|
107
107
|
#effect;
|
|
108
108
|
#effect2;
|
|
109
109
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXSelectionGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
110
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.3", type: AXSelectionGroupDirective, isStandalone: false, selector: "[axSelectionGroup]", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectionChanged: "onSelectionChanged" }, queries: [{ propertyName: "content", predicate: AXSelectionItemDirective, isSignal: true }], exportAs: ["axSelectionGroup"], ngImport: i0 }); }
|
|
110
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.3", type: AXSelectionGroupDirective, isStandalone: false, selector: "[axSelectionGroup]", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, selectedKeys: { classPropertyName: "selectedKeys", publicName: "selectedKeys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectionChanged: "onSelectionChanged" }, queries: [{ propertyName: "content", predicate: AXSelectionItemDirective, descendants: true, isSignal: true }], exportAs: ["axSelectionGroup"], ngImport: i0 }); }
|
|
111
111
|
}
|
|
112
112
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXSelectionGroupDirective, decorators: [{
|
|
113
113
|
type: Directive,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-selection.mjs","sources":["../../../../libs/cdk/selection/src/lib/selection-item.directive.ts","../../../../libs/cdk/selection/src/lib/selection-group.directive.ts","../../../../libs/cdk/selection/src/lib/selection.module.ts","../../../../libs/cdk/selection/src/acorex-cdk-selection.ts"],"sourcesContent":["import { afterNextRender, Directive, ElementRef, inject, input, output, signal } from '@angular/core';\n\n@Directive({\n selector: '[axSelectionItem]',\n exportAs: 'axSelectionItem',\n standalone: false,\n})\nexport class AXSelectionItemDirective {\n private elm = inject(ElementRef);\n isActive = signal(false);\n onClick = output<{ sender: AXSelectionItemDirective }>();\n key = input.required<string>();\n\n #init = afterNextRender(() => {\n (this.elm.nativeElement as HTMLElement).onclick = () => {\n this.onClick.emit({ sender: this });\n };\n });\n\n public toggle() {\n this.isActive.update((prev) => !prev);\n }\n public select() {\n this.isActive.set(true);\n }\n public unselect() {\n this.isActive.set(false);\n }\n}\n","import {\n AfterContentInit,\n afterNextRender,\n contentChildren,\n Directive,\n effect,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { AXSelectionItemDirective } from './selection-item.directive';\n\n@Directive({\n selector: '[axSelectionGroup]',\n standalone: false,\n exportAs: 'axSelectionGroup',\n})\nexport class AXSelectionGroupDirective implements AfterContentInit {\n private content = contentChildren(AXSelectionItemDirective);\n private activeIndex = signal(null);\n multiple = input(false);\n selectedKeys = input<string | string[]>();\n onSelectionChanged = output<{ sender: AXSelectionGroupDirective; selectedKeys: string[] }>();\n\n #init = afterNextRender(() => {\n this.content().forEach((element) => {\n element.onClick.subscribe((e) => {\n this.activeIndex.set(e.sender.key());\n if (this.multiple()) {\n element.toggle();\n } else {\n this.content().forEach((element) => {\n if (element.key() !== this.activeIndex()) {\n element.unselect();\n }\n });\n element.select();\n }\n });\n });\n });\n\n ngAfterContentInit(): void {\n if (!this.selectedKeys()) return;\n if (typeof this.selectedKeys() === 'string') {\n this.content().forEach((element) => {\n if (this.selectedKeys() === element.key()) {\n element.isActive.set(true);\n }\n });\n } else if (this.selectedKeys() instanceof Array) {\n (this.selectedKeys() as Array<string>).forEach((index) => {\n this.content().forEach((element) => {\n if (index === element.key()) {\n element.isActive.set(true);\n }\n });\n });\n }\n }\n\n #effect = effect(() => {\n if (!this.selectedKeys()) {\n this.content()[0].isActive.set(true);\n }\n });\n\n #effect2 = effect(() => {\n if (!this.activeIndex()) return;\n if (this.multiple()) {\n const selectedKeys = [];\n this.content().forEach((item) => {\n if (item.isActive()) {\n selectedKeys.push(item.key());\n }\n });\n this.onSelectionChanged.emit({ sender: this, selectedKeys: selectedKeys });\n } else {\n this.onSelectionChanged.emit({ sender: this, selectedKeys: [this.activeIndex()] });\n }\n });\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXSelectionGroupDirective } from './selection-group.directive';\nimport { AXSelectionItemDirective } from './selection-item.directive';\n\nconst COMPONENT = [AXSelectionGroupDirective, AXSelectionItemDirective];\nconst MODULES = [CommonModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXSelectionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAOa,wBAAwB,CAAA;AALrC,IAAA,WAAA,GAAA;AAMU,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;QACxB,IAAO,CAAA,OAAA,GAAG,MAAM,EAAwC;AACxD,QAAA,IAAA,CAAA,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAU;AAE9B,QAAA,IAAA,CAAA,KAAK,GAAG,eAAe,CAAC,MAAK;YAC1B,IAAI,CAAC,GAAG,CAAC,aAA6B,CAAC,OAAO,GAAG,MAAK;gBACrD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACrC,aAAC;AACH,SAAC,CAAC;AAWH;AAfC,IAAA,KAAK;IAME,MAAM,GAAA;AACX,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC;;IAEhC,MAAM,GAAA;AACX,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;;IAElB,QAAQ,GAAA;AACb,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;;8GAnBf,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAxB,wBAAwB,EAAA,YAAA,EAAA,KAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,GAAA,EAAA,EAAA,iBAAA,EAAA,KAAA,EAAA,UAAA,EAAA,KAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBALpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,UAAU,EAAE,KAAK;AAClB,iBAAA;;;MCWY,yBAAyB,CAAA;AALtC,IAAA,WAAA,GAAA;
|
|
1
|
+
{"version":3,"file":"acorex-cdk-selection.mjs","sources":["../../../../libs/cdk/selection/src/lib/selection-item.directive.ts","../../../../libs/cdk/selection/src/lib/selection-group.directive.ts","../../../../libs/cdk/selection/src/lib/selection.module.ts","../../../../libs/cdk/selection/src/acorex-cdk-selection.ts"],"sourcesContent":["import { afterNextRender, Directive, ElementRef, inject, input, output, signal } from '@angular/core';\n\n@Directive({\n selector: '[axSelectionItem]',\n exportAs: 'axSelectionItem',\n standalone: false,\n})\nexport class AXSelectionItemDirective {\n private elm = inject(ElementRef);\n isActive = signal(false);\n onClick = output<{ sender: AXSelectionItemDirective }>();\n key = input.required<string>();\n\n #init = afterNextRender(() => {\n (this.elm.nativeElement as HTMLElement).onclick = () => {\n this.onClick.emit({ sender: this });\n };\n });\n\n public toggle() {\n this.isActive.update((prev) => !prev);\n }\n public select() {\n this.isActive.set(true);\n }\n public unselect() {\n this.isActive.set(false);\n }\n}\n","import {\n AfterContentInit,\n afterNextRender,\n contentChildren,\n Directive,\n effect,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { AXSelectionItemDirective } from './selection-item.directive';\n\n@Directive({\n selector: '[axSelectionGroup]',\n standalone: false,\n exportAs: 'axSelectionGroup',\n})\nexport class AXSelectionGroupDirective implements AfterContentInit {\n private content = contentChildren(AXSelectionItemDirective, { descendants: true });\n private activeIndex = signal(null);\n multiple = input(false);\n selectedKeys = input<string | string[]>();\n onSelectionChanged = output<{ sender: AXSelectionGroupDirective; selectedKeys: string[] }>();\n\n #init = afterNextRender(() => {\n this.content().forEach((element) => {\n element.onClick.subscribe((e) => {\n this.activeIndex.set(e.sender.key());\n if (this.multiple()) {\n element.toggle();\n } else {\n this.content().forEach((element) => {\n if (element.key() !== this.activeIndex()) {\n element.unselect();\n }\n });\n element.select();\n }\n });\n });\n });\n\n ngAfterContentInit(): void {\n if (!this.selectedKeys()) return;\n if (typeof this.selectedKeys() === 'string') {\n this.content().forEach((element) => {\n if (this.selectedKeys() === element.key()) {\n element.isActive.set(true);\n }\n });\n } else if (this.selectedKeys() instanceof Array) {\n (this.selectedKeys() as Array<string>).forEach((index) => {\n this.content().forEach((element) => {\n if (index === element.key()) {\n element.isActive.set(true);\n }\n });\n });\n }\n }\n\n #effect = effect(() => {\n if (!this.selectedKeys()) {\n this.content()[0].isActive.set(true);\n }\n });\n\n #effect2 = effect(() => {\n if (!this.activeIndex()) return;\n if (this.multiple()) {\n const selectedKeys = [];\n this.content().forEach((item) => {\n if (item.isActive()) {\n selectedKeys.push(item.key());\n }\n });\n this.onSelectionChanged.emit({ sender: this, selectedKeys: selectedKeys });\n } else {\n this.onSelectionChanged.emit({ sender: this, selectedKeys: [this.activeIndex()] });\n }\n });\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXSelectionGroupDirective } from './selection-group.directive';\nimport { AXSelectionItemDirective } from './selection-item.directive';\n\nconst COMPONENT = [AXSelectionGroupDirective, AXSelectionItemDirective];\nconst MODULES = [CommonModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXSelectionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAOa,wBAAwB,CAAA;AALrC,IAAA,WAAA,GAAA;AAMU,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;QACxB,IAAO,CAAA,OAAA,GAAG,MAAM,EAAwC;AACxD,QAAA,IAAA,CAAA,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAU;AAE9B,QAAA,IAAA,CAAA,KAAK,GAAG,eAAe,CAAC,MAAK;YAC1B,IAAI,CAAC,GAAG,CAAC,aAA6B,CAAC,OAAO,GAAG,MAAK;gBACrD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACrC,aAAC;AACH,SAAC,CAAC;AAWH;AAfC,IAAA,KAAK;IAME,MAAM,GAAA;AACX,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC;;IAEhC,MAAM,G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B,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class AXListNavigationItemDirective {
|
|
4
|
+
#private;
|
|
5
|
+
itemElem: ElementRef<any>;
|
|
6
|
+
isActive: import("@angular/core").WritableSignal<boolean>;
|
|
7
|
+
navigationItemKey: number;
|
|
8
|
+
navigationParentItemKey: import("@angular/core").WritableSignal<any>;
|
|
9
|
+
index: import("@angular/core").WritableSignal<any>;
|
|
10
|
+
private parent;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXListNavigationItemDirective, never>;
|
|
12
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AXListNavigationItemDirective, "[axListNavigationItem]", ["axListNavigationItem"], {}, {}, never, never, false, never>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AXListNavigationItemDirective } from './list-navigation-item.directive';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class AXListNavigationDirective {
|
|
4
|
+
#private;
|
|
5
|
+
private parentElem;
|
|
6
|
+
private childElem;
|
|
7
|
+
private activeIndex;
|
|
8
|
+
private holdShift;
|
|
9
|
+
onNavigationChanged: import("@angular/core").OutputEmitterRef<{
|
|
10
|
+
sender: AXListNavigationDirective;
|
|
11
|
+
}>;
|
|
12
|
+
orientation: import("@angular/core").InputSignal<"horizontal" | "vertical">;
|
|
13
|
+
private navigationHandler;
|
|
14
|
+
private parentNavigationHandler;
|
|
15
|
+
navigateTo(e: AXListNavigationItemDirective): void;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXListNavigationDirective, never>;
|
|
17
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AXListNavigationDirective, "[axListNavigation]", ["axListNavigation"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, { "onNavigationChanged": "onNavigationChanged"; }, ["childElem"], never, false, never>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./list-navigation.directive";
|
|
3
|
+
import * as i2 from "./list-navigation-item.directive";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
export declare class AXListNavigationModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXListNavigationModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXListNavigationModule, [typeof i1.AXListNavigationDirective, typeof i2.AXListNavigationItemDirective], [typeof i3.CommonModule], [typeof i1.AXListNavigationDirective, typeof i2.AXListNavigationItemDirective]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AXListNavigationModule>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Router } from '@angular/router';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export type outlineItemType = {
|
|
5
|
+
el: HTMLElement;
|
|
6
|
+
active: boolean;
|
|
7
|
+
scrollY: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class AXOutlineContainerDirective {
|
|
10
|
+
#private;
|
|
11
|
+
router: Router;
|
|
12
|
+
private zone;
|
|
13
|
+
private el;
|
|
14
|
+
private unsubscriber;
|
|
15
|
+
target: import("@angular/core").InputSignal<string>;
|
|
16
|
+
smoothScroll: import("@angular/core").InputSignal<boolean>;
|
|
17
|
+
activationOffset: import("@angular/core").InputSignal<number>;
|
|
18
|
+
activateLastAtBottom: import("@angular/core").InputSignal<boolean>;
|
|
19
|
+
private scrollTop;
|
|
20
|
+
private outlineItems;
|
|
21
|
+
outlineItems$: BehaviorSubject<outlineItemType[]>;
|
|
22
|
+
private scrollChanged;
|
|
23
|
+
private setOutlineItems;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXOutlineContainerDirective, never>;
|
|
25
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AXOutlineContainerDirective, "[axOutlineContainer]", ["axOutlineContainer"], { "target": { "alias": "target"; "required": false; "isSignal": true; }; "smoothScroll": { "alias": "smoothScroll"; "required": false; "isSignal": true; }; "activationOffset": { "alias": "activationOffset"; "required": false; "isSignal": true; }; "activateLastAtBottom": { "alias": "activateLastAtBottom"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class AXOutlineItemDirective {
|
|
3
|
+
#private;
|
|
4
|
+
private el;
|
|
5
|
+
id: import("@angular/core").InputSignal<string>;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXOutlineItemDirective, never>;
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AXOutlineItemDirective, "[axOutlineItem]", ["axOutlineItem"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./outline-container.directive";
|
|
3
|
+
import * as i2 from "./outline-item.directive";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
export declare class AXOutlineModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXOutlineModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXOutlineModule, [typeof i1.AXOutlineContainerDirective, typeof i2.AXOutlineItemDirective], [typeof i3.CommonModule], [typeof i1.AXOutlineContainerDirective, typeof i2.AXOutlineItemDirective]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AXOutlineModule>;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acorex/cdk",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.7.0-next.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": ">=19.0.0",
|
|
6
6
|
"@angular/core": ">=19.0.0",
|
|
@@ -31,6 +31,18 @@
|
|
|
31
31
|
"types": "./collapse/index.d.ts",
|
|
32
32
|
"default": "./fesm2022/acorex-cdk-collapse.mjs"
|
|
33
33
|
},
|
|
34
|
+
"./list-navigation": {
|
|
35
|
+
"types": "./list-navigation/index.d.ts",
|
|
36
|
+
"default": "./fesm2022/acorex-cdk-list-navigation.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./outline": {
|
|
39
|
+
"types": "./outline/index.d.ts",
|
|
40
|
+
"default": "./fesm2022/acorex-cdk-outline.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./pan-view": {
|
|
43
|
+
"types": "./pan-view/index.d.ts",
|
|
44
|
+
"default": "./fesm2022/acorex-cdk-pan-view.mjs"
|
|
45
|
+
},
|
|
34
46
|
"./qrcode": {
|
|
35
47
|
"types": "./qrcode/index.d.ts",
|
|
36
48
|
"default": "./fesm2022/acorex-cdk-qrcode.mjs"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class AXPanViewDirective {
|
|
3
|
+
#private;
|
|
4
|
+
private zone;
|
|
5
|
+
private render;
|
|
6
|
+
private el;
|
|
7
|
+
private prevX;
|
|
8
|
+
private prevY;
|
|
9
|
+
private pointerDown;
|
|
10
|
+
private wrapper;
|
|
11
|
+
zoomStep: import("@angular/core").InputSignal<number>;
|
|
12
|
+
minZoom: import("@angular/core").InputSignal<number>;
|
|
13
|
+
maxZoom: import("@angular/core").InputSignal<number>;
|
|
14
|
+
disablePan: import("@angular/core").InputSignal<boolean>;
|
|
15
|
+
disableZoom: import("@angular/core").InputSignal<boolean>;
|
|
16
|
+
wrapperClasses: import("@angular/core").InputSignal<string>;
|
|
17
|
+
panX: import("@angular/core").ModelSignal<number>;
|
|
18
|
+
panY: import("@angular/core").ModelSignal<number>;
|
|
19
|
+
zoom: import("@angular/core").ModelSignal<number>;
|
|
20
|
+
zoomChange: import("@angular/core").OutputEmitterRef<number>;
|
|
21
|
+
positionChange: import("@angular/core").OutputEmitterRef<{
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}>;
|
|
25
|
+
private nativeEl;
|
|
26
|
+
private zoomValue;
|
|
27
|
+
private handleZoomChange;
|
|
28
|
+
private createWrapper;
|
|
29
|
+
private handlePointerDown;
|
|
30
|
+
private handlePointerMove;
|
|
31
|
+
private handlePointerUp;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPanViewDirective, never>;
|
|
33
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AXPanViewDirective, "[axPanView]", ["axPanView"], { "zoomStep": { "alias": "zoomStep"; "required": false; "isSignal": true; }; "minZoom": { "alias": "minZoom"; "required": false; "isSignal": true; }; "maxZoom": { "alias": "maxZoom"; "required": false; "isSignal": true; }; "disablePan": { "alias": "disablePan"; "required": false; "isSignal": true; }; "disableZoom": { "alias": "disableZoom"; "required": false; "isSignal": true; }; "wrapperClasses": { "alias": "wrapperClasses"; "required": false; "isSignal": true; }; "panX": { "alias": "panX"; "required": false; "isSignal": true; }; "panY": { "alias": "panY"; "required": false; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; }, { "panX": "panXChange"; "panY": "panYChange"; "zoom": "zoomChange"; "zoomChange": "zoomChange"; "positionChange": "positionChange"; }, never, never, false, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./pan-view.directive";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
export declare class AXPanViewModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPanViewModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXPanViewModule, [typeof i1.AXPanViewDirective], [typeof i2.CommonModule], [typeof i1.AXPanViewDirective]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AXPanViewModule>;
|
|
8
|
+
}
|