@acorex/components 20.7.27 → 20.7.29
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-components-conversation2.mjs +2 -2
- package/fesm2022/acorex-components-conversation2.mjs.map +1 -1
- package/fesm2022/acorex-components-file-explorer.mjs +1 -1
- package/fesm2022/acorex-components-file-explorer.mjs.map +1 -1
- package/fesm2022/acorex-components-menu.mjs +23 -2
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-popup.mjs +2 -2
- package/fesm2022/acorex-components-popup.mjs.map +1 -1
- package/fesm2022/acorex-components-side-menu.mjs +17 -17
- package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
- package/menu/index.d.ts +7 -1
- package/package.json +26 -26
- package/popup/index.d.ts +1 -1
- package/side-menu/index.d.ts +2 -3
|
@@ -6,7 +6,10 @@ import { AXUnsubscriber, AXHtmlUtil } from '@acorex/core/utils';
|
|
|
6
6
|
import { AXZIndexService } from '@acorex/core/z-index';
|
|
7
7
|
import { isPlatformBrowser, NgTemplateOutlet, AsyncPipe } from '@angular/common';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
|
-
import { Injectable, signal, inject, Renderer2, computed, output, input, afterNextRender, HostBinding, HostListener, ChangeDetectionStrategy, ViewEncapsulation, Component, DOCUMENT, PLATFORM_ID, Injector, NgModule } from '@angular/core';
|
|
9
|
+
import { Injectable, signal, inject, Renderer2, computed, output, input, afterNextRender, HostBinding, HostListener, ChangeDetectionStrategy, ViewEncapsulation, Component, DOCUMENT, PLATFORM_ID, Injector, DestroyRef, NgModule } from '@angular/core';
|
|
10
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
11
|
+
import { Router, NavigationStart } from '@angular/router';
|
|
12
|
+
import { filter } from 'rxjs/operators';
|
|
10
13
|
import { cloneDeep } from 'lodash-es';
|
|
11
14
|
import { Subject } from 'rxjs';
|
|
12
15
|
|
|
@@ -427,6 +430,8 @@ class AXContextMenuComponent extends NXComponent {
|
|
|
427
430
|
this.orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
428
431
|
this.openOn = input('hover', ...(ngDevMode ? [{ debugName: "openOn" }] : []));
|
|
429
432
|
this.closeOn = input('click', ...(ngDevMode ? [{ debugName: "closeOn" }] : []));
|
|
433
|
+
/** When true, closes the menu on router navigation (e.g. side-menu route changes). */
|
|
434
|
+
this.closeOnRouteChange = input(false, ...(ngDevMode ? [{ debugName: "closeOnRouteChange" }] : []));
|
|
430
435
|
this.originalItems = input([], ...(ngDevMode ? [{ debugName: "originalItems", alias: 'items' }] : [{ alias: 'items' }]));
|
|
431
436
|
this.target = input(...(ngDevMode ? [undefined, { debugName: "target" }] : []));
|
|
432
437
|
this.onItemClick = output();
|
|
@@ -443,6 +448,8 @@ class AXContextMenuComponent extends NXComponent {
|
|
|
443
448
|
this.injector = inject(Injector);
|
|
444
449
|
this.zToken = null;
|
|
445
450
|
this.lastOpenPoint = null;
|
|
451
|
+
this.router = inject(Router, { optional: true });
|
|
452
|
+
this.destroyRef = inject(DestroyRef);
|
|
446
453
|
this.originalNextSibling = null;
|
|
447
454
|
this.originalParent = null;
|
|
448
455
|
this.items = signal([], ...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
@@ -450,6 +457,7 @@ class AXContextMenuComponent extends NXComponent {
|
|
|
450
457
|
afterNextRender(() => {
|
|
451
458
|
this.bindContextEvent();
|
|
452
459
|
});
|
|
460
|
+
this.setupCloseOnRouteChange();
|
|
453
461
|
this.service.closeAllContextMenu$.subscribe(() => {
|
|
454
462
|
this.service.closeAll$.next();
|
|
455
463
|
this.close();
|
|
@@ -522,6 +530,19 @@ class AXContextMenuComponent extends NXComponent {
|
|
|
522
530
|
}
|
|
523
531
|
// Private Methods (Internal Logic)
|
|
524
532
|
/** @ignore */
|
|
533
|
+
setupCloseOnRouteChange() {
|
|
534
|
+
if (!this.router || !isPlatformBrowser(this.platformID)) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
this.router.events
|
|
538
|
+
.pipe(filter((event) => event instanceof NavigationStart), takeUntilDestroyed(this.destroyRef))
|
|
539
|
+
.subscribe(() => {
|
|
540
|
+
if (this.closeOnRouteChange()) {
|
|
541
|
+
this.close();
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
/** @ignore */
|
|
525
546
|
getTargetElements() {
|
|
526
547
|
if (isPlatformBrowser(this.platformID)) {
|
|
527
548
|
const elements = typeof this.target() == 'string'
|
|
@@ -711,7 +732,7 @@ class AXContextMenuComponent extends NXComponent {
|
|
|
711
732
|
return ['ax-menu-container', `ax-orientation-${this.orientation()}`, 'ax-action-list', 'ax-action-list-vertical'];
|
|
712
733
|
}
|
|
713
734
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXContextMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
714
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXContextMenuComponent, isStandalone: true, selector: "ax-context-menu", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, openOn: { classPropertyName: "openOn", publicName: "openOn", isSignal: true, isRequired: false, transformFunction: null }, closeOn: { classPropertyName: "closeOn", publicName: "closeOn", isSignal: true, isRequired: false, transformFunction: null }, originalItems: { classPropertyName: "originalItems", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onItemClick: "onItemClick", onOpening: "onOpening", onClose: "onClose" }, host: { listeners: { "window:scroll": "onWindowEvent($event)", "window:resize": "onWindowEvent($event)" }, properties: { "class": "this.__hostClass" } }, providers: [
|
|
735
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXContextMenuComponent, isStandalone: true, selector: "ax-context-menu", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, openOn: { classPropertyName: "openOn", publicName: "openOn", isSignal: true, isRequired: false, transformFunction: null }, closeOn: { classPropertyName: "closeOn", publicName: "closeOn", isSignal: true, isRequired: false, transformFunction: null }, closeOnRouteChange: { classPropertyName: "closeOnRouteChange", publicName: "closeOnRouteChange", isSignal: true, isRequired: false, transformFunction: null }, originalItems: { classPropertyName: "originalItems", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onItemClick: "onItemClick", onOpening: "onOpening", onClose: "onClose" }, host: { listeners: { "window:scroll": "onWindowEvent($event)", "window:resize": "onWindowEvent($event)" }, properties: { "class": "this.__hostClass" } }, providers: [
|
|
715
736
|
AXMenuService,
|
|
716
737
|
{
|
|
717
738
|
provide: AXRootMenu,
|