@acorex/cdk 19.8.0-next.9 → 19.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,9 +36,14 @@ class AXListNavigationDirective {
36
36
  this.activeIndex = signal(null);
37
37
  this.holdShift = signal(false);
38
38
  this.onNavigationChanged = output();
39
+ this.onPressEnterOrSpace = output();
39
40
  this.orientation = input('vertical');
40
41
  this.#init = afterNextRender(() => {
41
42
  this.parentElem.nativeElement.onkeydown = (e) => {
43
+ if (e.code === 'Enter' || e.code === 'Space') {
44
+ e.preventDefault();
45
+ this.activeByKeyboardHandler();
46
+ }
42
47
  if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
43
48
  this.holdShift.set(true);
44
49
  }
@@ -135,8 +140,11 @@ class AXListNavigationDirective {
135
140
  e.isActive.set(true);
136
141
  this.activeIndex.set(e.index());
137
142
  }
143
+ activeByKeyboardHandler() {
144
+ this.onPressEnterOrSpace.emit({ active: this.activeIndex() });
145
+ }
138
146
  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 }); }
147
+ 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", onPressEnterOrSpace: "onPressEnterOrSpace" }, queries: [{ propertyName: "childElem", predicate: AXListNavigationItemDirective, descendants: true, isSignal: true }], exportAs: ["axListNavigation"], ngImport: i0 }); }
140
148
  }
141
149
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXListNavigationDirective, decorators: [{
142
150
  type: Directive,
@@ -1 +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,CAAC,IAAI,CAAC;AACtC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;AAEZ,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,C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;+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;;;;"}
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 onPressEnterOrSpace = output<{ active: number }>();\n orientation = input<'horizontal' | 'vertical'>('vertical');\n\n #init = afterNextRender(() => {\n (this.parentElem.nativeElement as HTMLElement).onkeydown = (e: KeyboardEvent) => {\n if (e.code === 'Enter' || e.code === 'Space') {\n e.preventDefault();\n this.activeByKeyboardHandler();\n }\n\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 private activeByKeyboardHandler() {\n this.onPressEnterOrSpace.emit({ active: this.activeIndex() });\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 A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AA,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;;;;"}
@@ -1,12 +1,11 @@
1
- import { DOCUMENT, CommonModule } from '@angular/common';
2
1
  import * as i0 from '@angular/core';
3
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
4
 
5
5
  class AXPanViewDirective {
6
6
  constructor() {
7
7
  this.zone = inject(NgZone);
8
8
  this.render = inject(Renderer2);
9
- this.document = inject(DOCUMENT);
10
9
  this.el = inject((ElementRef));
11
10
  this.prevX = signal(0);
12
11
  this.prevY = signal(0);
@@ -40,31 +39,40 @@ class AXPanViewDirective {
40
39
  this.#anr = afterNextRender(() => {
41
40
  // Create Wrapper
42
41
  this.createWrapper();
43
- this.zone.runOutsideAngular(() => {
44
- // Wheel Event
45
- this.wrapper().onwheel = (e) => {
46
- e.preventDefault();
47
- if (e.ctrlKey) {
48
- this.handleZoomChange(e);
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())
49
56
  return;
50
- }
51
- else if (e.shiftKey) {
52
- if (this.disablePan())
53
- return;
54
- this.panX.update((prev) => prev - e.deltaY / 3);
55
- }
56
- else {
57
- if (this.disablePan())
58
- return;
59
- this.panY.update((prev) => prev - e.deltaY / 3);
60
- }
61
- };
62
- // Pointer Down Event
63
- this.wrapper().onpointerdown = (e) => this.handlePointerDown(e);
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
+ });
64
65
  // Pointer Move Event
65
- this.document.onpointermove = (e) => this.handlePointerMove(e);
66
+ this.render.listen(this.wrapper(), 'pointermove', (e) => {
67
+ this.handlePointerMove(e);
68
+ });
66
69
  // Pointer Up/Leave Event
67
- this.document.onpointerup = (e) => this.handlePointerUp(e);
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
+ });
68
76
  });
69
77
  });
70
78
  }
@@ -1 +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 { DOCUMENT } from '@angular/common';\nimport {\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 document = inject(DOCUMENT);\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 this.zone.runOutsideAngular(() => {\n // Wheel Event\n this.wrapper().onwheel = (e) => {\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.wrapper().onpointerdown = (e) => this.handlePointerDown(e);\n // Pointer Move Event\n this.document.onpointermove = (e) => this.handlePointerMove(e);\n // Pointer Up/Leave Event\n this.document.onpointerup = (e) => this.handlePointerUp(e);\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":";;;;MAqBa,kBAAk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C,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;ACZD;;AAEG;;;;"}
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,IAA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,EAAE,EAAE;AACd,iBAAA;;;ACZD;;AAEG;;;;"}
@@ -38,23 +38,20 @@ 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, { descendants: true });
42
41
  this.activeIndex = signal(null);
43
42
  this.multiple = input(false);
44
- this.disable = input(false);
45
43
  this.selectedKeys = input();
46
44
  this.onSelectionChanged = output();
45
+ this.selectionItemsClass = contentChildren(AXSelectionItemDirective, { descendants: true });
47
46
  this.#init = afterNextRender(() => {
48
- this.content().forEach((element) => {
47
+ this.selectionItemsClass().forEach((element) => {
49
48
  element.onClick.subscribe((e) => {
50
- if (this.disable())
51
- return;
52
49
  this.activeIndex.set(e.sender.key());
53
50
  if (this.multiple()) {
54
51
  element.toggle();
55
52
  }
56
53
  else {
57
- this.content().forEach((element) => {
54
+ this.selectionItemsClass().forEach((element) => {
58
55
  if (element.key() !== this.activeIndex()) {
59
56
  element.unselect();
60
57
  }
@@ -65,38 +62,16 @@ class AXSelectionGroupDirective {
65
62
  });
66
63
  });
67
64
  this.#effect = effect(() => {
68
- if (!this.selectedKeys())
69
- return;
70
- if (typeof this.selectedKeys() === 'string' || typeof this.selectedKeys() === 'number') {
71
- this.content().forEach((element) => {
72
- element.isActive.set(false);
73
- if (this.selectedKeys() === element.key()) {
74
- element.isActive.set(true);
75
- }
76
- });
77
- }
78
- else if (this.selectedKeys() instanceof Array) {
79
- this.selectedKeys().forEach((index) => {
80
- this.content().forEach((element) => {
81
- element.isActive.set(false);
82
- if (index === element.key()) {
83
- element.isActive.set(true);
84
- }
85
- });
86
- });
87
- }
88
- });
89
- this.#effect2 = effect(() => {
90
65
  if (!this.selectedKeys()) {
91
- this.content()[0].isActive.set(true);
66
+ this.selectionItemsClass()[0].isActive.set(true);
92
67
  }
93
68
  });
94
- this.#effect3 = effect(() => {
69
+ this.#effect2 = effect(() => {
95
70
  if (!this.activeIndex())
96
71
  return;
97
72
  if (this.multiple()) {
98
73
  const selectedKeys = [];
99
- this.content().forEach((item) => {
74
+ this.selectionItemsClass().forEach((item) => {
100
75
  if (item.isActive()) {
101
76
  selectedKeys.push(item.key());
102
77
  }
@@ -109,11 +84,36 @@ class AXSelectionGroupDirective {
109
84
  });
110
85
  }
111
86
  #init;
87
+ ngAfterContentInit() {
88
+ if (!this.selectedKeys())
89
+ return;
90
+ if (typeof this.selectedKeys() === 'string') {
91
+ this.selectionItemsClass().forEach((element) => {
92
+ if (this.selectedKeys() === element.key()) {
93
+ element.isActive.set(true);
94
+ }
95
+ });
96
+ }
97
+ else if (this.selectedKeys() instanceof Array) {
98
+ this.selectedKeys().forEach((index) => {
99
+ this.selectionItemsClass().forEach((element) => {
100
+ if (index === element.key()) {
101
+ element.isActive.set(true);
102
+ }
103
+ });
104
+ });
105
+ }
106
+ }
112
107
  #effect;
113
108
  #effect2;
114
- #effect3;
109
+ activeItemByIndex(...restParams) {
110
+ this.selectionItemsClass().forEach((item) => item.isActive.set(false));
111
+ restParams.forEach((item) => {
112
+ this.selectionItemsClass()[item].isActive.set(true);
113
+ });
114
+ }
115
115
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXSelectionGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
116
- 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 }, disable: { classPropertyName: "disable", publicName: "disable", 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 }); }
116
+ 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: "selectionItemsClass", predicate: AXSelectionItemDirective, descendants: true, isSignal: true }], exportAs: ["axSelectionGroup"], ngImport: i0 }); }
117
117
  }
118
118
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXSelectionGroupDirective, decorators: [{
119
119
  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 | number>();\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 { afterNextRender, contentChildren, Directive, effect, input, output, signal } 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 {\n private content = contentChildren(AXSelectionItemDirective, { descendants: true });\n private activeIndex = signal(null);\n multiple = input(false);\n disable = input(false);\n selectedKeys = input<string | string[] | number | number[]>();\n onSelectionChanged = output<{ sender: AXSelectionGroupDirective; selectedKeys: string[] }>();\n\n #init = afterNextRender(() => {\n this.content().forEach((element) => {\n element.onClick.subscribe((e) => {\n if (this.disable()) return;\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 #effect = effect(() => {\n if (!this.selectedKeys()) return;\n\n if (typeof this.selectedKeys() === 'string' || typeof this.selectedKeys() === 'number') {\n this.content().forEach((element) => {\n element.isActive.set(false);\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 element.isActive.set(false);\n if (index === element.key()) {\n element.isActive.set(true);\n }\n });\n });\n }\n });\n\n #effect2 = effect(() => {\n if (!this.selectedKeys()) {\n this.content()[0].isActive.set(true);\n }\n });\n\n #effect3 = 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,EAAmB;AAEvC,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,I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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 activeIndex = signal(null);\n multiple = input(false);\n selectedKeys = input<string | string[]>();\n onSelectionChanged = output<{ sender: AXSelectionGroupDirective; selectedKeys: string[] }>();\n selectionItemsClass = contentChildren(AXSelectionItemDirective, { descendants: true });\n\n #init = afterNextRender(() => {\n this.selectionItemsClass().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.selectionItemsClass().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.selectionItemsClass().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.selectionItemsClass().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.selectionItemsClass()[0].isActive.set(true);\n }\n });\n\n #effect2 = effect(() => {\n if (!this.activeIndex()) return;\n if (this.multiple()) {\n const selectedKeys = [];\n this.selectionItemsClass().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 activeItemByIndex(...restParams: number[]) {\n this.selectionItemsClass().forEach((item) => item.isActive.set(false));\n restParams.forEach((item) => {\n this.selectionItemsClass()[item].isActive.set(true);\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,IA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EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAjB,iBAAiB,EAAA,YAAA,EAAA,CATX,yBAAyB,EAAE,wBAAwB,aACrD,YAAY,CAAA,EAAA,OAAA,EAAA,CADV,yBAAyB,EAAE,wBAAwB,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,iBAAiB,YAJf,OAAO,CAAA,EAAA,CAAA,CAAA;;2FAIT,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAN7B,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;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Directive, Input, Output } from '@angular/core';
2
+ import { EventEmitter, Input, Output, Directive } from '@angular/core';
3
3
 
4
4
  class AXStickyDirective {
5
5
  get isSticky() {
@@ -9,10 +9,14 @@ export declare class AXListNavigationDirective {
9
9
  onNavigationChanged: import("@angular/core").OutputEmitterRef<{
10
10
  sender: AXListNavigationDirective;
11
11
  }>;
12
+ onPressEnterOrSpace: import("@angular/core").OutputEmitterRef<{
13
+ active: number;
14
+ }>;
12
15
  orientation: import("@angular/core").InputSignal<"horizontal" | "vertical">;
13
16
  private navigationHandler;
14
17
  private parentNavigationHandler;
15
18
  navigateTo(e: AXListNavigationItemDirective): void;
19
+ private activeByKeyboardHandler;
16
20
  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>;
21
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AXListNavigationDirective, "[axListNavigation]", ["axListNavigation"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, { "onNavigationChanged": "onNavigationChanged"; "onPressEnterOrSpace": "onPressEnterOrSpace"; }, ["childElem"], never, false, never>;
18
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex/cdk",
3
- "version": "19.8.0-next.9",
3
+ "version": "19.9.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=19.0.0",
6
6
  "@angular/core": ">=19.0.0",
@@ -3,7 +3,6 @@ export declare class AXPanViewDirective {
3
3
  #private;
4
4
  private zone;
5
5
  private render;
6
- private document;
7
6
  private el;
8
7
  private prevX;
9
8
  private prevY;
@@ -1,15 +1,18 @@
1
+ import { AfterContentInit } from '@angular/core';
2
+ import { AXSelectionItemDirective } from './selection-item.directive';
1
3
  import * as i0 from "@angular/core";
2
- export declare class AXSelectionGroupDirective {
4
+ export declare class AXSelectionGroupDirective implements AfterContentInit {
3
5
  #private;
4
- private content;
5
6
  private activeIndex;
6
7
  multiple: import("@angular/core").InputSignal<boolean>;
7
- disable: import("@angular/core").InputSignal<boolean>;
8
- selectedKeys: import("@angular/core").InputSignal<string | number | string[] | number[]>;
8
+ selectedKeys: import("@angular/core").InputSignal<string | string[]>;
9
9
  onSelectionChanged: import("@angular/core").OutputEmitterRef<{
10
10
  sender: AXSelectionGroupDirective;
11
11
  selectedKeys: string[];
12
12
  }>;
13
+ selectionItemsClass: import("@angular/core").Signal<readonly AXSelectionItemDirective[]>;
14
+ ngAfterContentInit(): void;
15
+ activeItemByIndex(...restParams: number[]): void;
13
16
  static ɵfac: i0.ɵɵFactoryDeclaration<AXSelectionGroupDirective, never>;
14
- static ɵdir: i0.ɵɵDirectiveDeclaration<AXSelectionGroupDirective, "[axSelectionGroup]", ["axSelectionGroup"], { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "disable": { "alias": "disable"; "required": false; "isSignal": true; }; "selectedKeys": { "alias": "selectedKeys"; "required": false; "isSignal": true; }; }, { "onSelectionChanged": "onSelectionChanged"; }, ["content"], never, false, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AXSelectionGroupDirective, "[axSelectionGroup]", ["axSelectionGroup"], { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "selectedKeys": { "alias": "selectedKeys"; "required": false; "isSignal": true; }; }, { "onSelectionChanged": "onSelectionChanged"; }, ["selectionItemsClass"], never, false, never>;
15
18
  }
@@ -6,7 +6,7 @@ export declare class AXSelectionItemDirective {
6
6
  onClick: import("@angular/core").OutputEmitterRef<{
7
7
  sender: AXSelectionItemDirective;
8
8
  }>;
9
- key: import("@angular/core").InputSignal<string | number>;
9
+ key: import("@angular/core").InputSignal<string>;
10
10
  toggle(): void;
11
11
  select(): void;
12
12
  unselect(): void;