@ngrdt/menu 0.0.71 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngrdt-menu.mjs +16 -17
- package/fesm2022/ngrdt-menu.mjs.map +1 -1
- package/index.d.ts +3 -5
- package/package.json +5 -5
package/fesm2022/ngrdt-menu.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import * as i3 from '@ngrdt/router';
|
|
|
11
11
|
import { RdtRouterService, RdtAnyRouteActiveDirective } from '@ngrdt/router';
|
|
12
12
|
import * as i4 from '@ngrdt/shortcuts';
|
|
13
13
|
import { RdtShortcutService, RdtShortcut, RdtKeyListenerDirective } from '@ngrdt/shortcuts';
|
|
14
|
-
import { RdtStringUtils, KB_CODE, RdtObjectUtils
|
|
14
|
+
import { RdtStringUtils, KB_CODE, RdtObjectUtils } from '@ngrdt/utils';
|
|
15
15
|
import { delay, of, map, first, merge, fromEvent, throttleTime, animationFrameScheduler, switchMap, withLatestFrom } from 'rxjs';
|
|
16
16
|
import { RDT_BUTTON_BASE_PROVIDER } from '@ngrdt/button';
|
|
17
17
|
|
|
@@ -306,6 +306,7 @@ class RdtMenuOverlayComponent {
|
|
|
306
306
|
return this.topLevelMenu.bodyMargin.top;
|
|
307
307
|
}
|
|
308
308
|
getMaxOffsetTop() {
|
|
309
|
+
console.log(this.item().label, this.topLevelMenu.clientSize.height, this._box.height, this.topLevelMenu.bodyMargin.bottom);
|
|
309
310
|
return (this.topLevelMenu.clientSize.height -
|
|
310
311
|
this._box.height -
|
|
311
312
|
this.topLevelMenu.bodyMargin.bottom);
|
|
@@ -803,9 +804,9 @@ class RdtMenuBaseComponent {
|
|
|
803
804
|
}
|
|
804
805
|
});
|
|
805
806
|
get clientSize() {
|
|
806
|
-
return this.
|
|
807
|
+
return this._windowSize;
|
|
807
808
|
}
|
|
808
|
-
|
|
809
|
+
_windowSize;
|
|
809
810
|
get bodyMargin() {
|
|
810
811
|
return this._bodyMargin;
|
|
811
812
|
}
|
|
@@ -833,10 +834,14 @@ class RdtMenuBaseComponent {
|
|
|
833
834
|
constructor() {
|
|
834
835
|
this.listenShortcuts();
|
|
835
836
|
afterNextRender(() => {
|
|
836
|
-
this.
|
|
837
|
+
this.listenWindowResizeScroll();
|
|
837
838
|
this.measure();
|
|
838
839
|
this.recalculateChildren();
|
|
839
840
|
});
|
|
841
|
+
setTimeout(() => {
|
|
842
|
+
this.measure();
|
|
843
|
+
this.recalculateChildren();
|
|
844
|
+
}, 1000);
|
|
840
845
|
}
|
|
841
846
|
recalcChildrenEffect = effect(() => this.recalculateChildren());
|
|
842
847
|
recalculateChildren() {
|
|
@@ -1047,6 +1052,7 @@ class RdtMenuBaseComponent {
|
|
|
1047
1052
|
this.measureButtonContainer();
|
|
1048
1053
|
this.measureClientSize();
|
|
1049
1054
|
this.readMargin();
|
|
1055
|
+
console.log('containerRect', this.buttonContainerRect);
|
|
1050
1056
|
}
|
|
1051
1057
|
readMargin() {
|
|
1052
1058
|
const computedStyle = getComputedStyle(this.elRef.nativeElement);
|
|
@@ -1062,9 +1068,9 @@ class RdtMenuBaseComponent {
|
|
|
1062
1068
|
};
|
|
1063
1069
|
}
|
|
1064
1070
|
measureClientSize() {
|
|
1065
|
-
this.
|
|
1066
|
-
width:
|
|
1067
|
-
height:
|
|
1071
|
+
this._windowSize = {
|
|
1072
|
+
width: window.innerWidth,
|
|
1073
|
+
height: window.innerHeight,
|
|
1068
1074
|
};
|
|
1069
1075
|
}
|
|
1070
1076
|
measureButtonContainer() {
|
|
@@ -1076,9 +1082,8 @@ class RdtMenuBaseComponent {
|
|
|
1076
1082
|
this._buttonContainerRect = undefined;
|
|
1077
1083
|
}
|
|
1078
1084
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
merge(RdtDomUtils.getResizeEvent$(element), fromEvent(window, 'scroll'))
|
|
1085
|
+
listenWindowResizeScroll() {
|
|
1086
|
+
merge(fromEvent(window, 'resize'), fromEvent(window, 'scroll'))
|
|
1082
1087
|
.pipe(throttleTime(0, animationFrameScheduler, { trailing: true }), takeUntilDestroyed(this.destroyRef))
|
|
1083
1088
|
.subscribe(() => {
|
|
1084
1089
|
this.measure();
|
|
@@ -1238,7 +1243,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImpor
|
|
|
1238
1243
|
class RdtMenuComponent extends RdtMenuBaseComponent {
|
|
1239
1244
|
buttonClass = inject(RDT_BUTTON_BASE_PROVIDER);
|
|
1240
1245
|
trigger = input.required();
|
|
1241
|
-
dataTestId = input('');
|
|
1242
1246
|
items = input.required();
|
|
1243
1247
|
allParsedItems = computed(() => {
|
|
1244
1248
|
const items = this.items();
|
|
@@ -1271,11 +1275,6 @@ class RdtMenuComponent extends RdtMenuBaseComponent {
|
|
|
1271
1275
|
const trigger = this.trigger();
|
|
1272
1276
|
trigger.tabIndex.set(0);
|
|
1273
1277
|
});
|
|
1274
|
-
triggerDataTestIdEffect = effect(() => {
|
|
1275
|
-
const trigger = this.trigger();
|
|
1276
|
-
const dataTestId = this.dataTestId();
|
|
1277
|
-
trigger.dataTestId.set(dataTestId);
|
|
1278
|
-
});
|
|
1279
1278
|
triggerAriaEffect = effect(() => {
|
|
1280
1279
|
const trigger = this.trigger();
|
|
1281
1280
|
const expandedChild = this.expandedChild();
|
|
@@ -1308,7 +1307,7 @@ class RdtMenuComponent extends RdtMenuBaseComponent {
|
|
|
1308
1307
|
}
|
|
1309
1308
|
}
|
|
1310
1309
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1311
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtMenuComponent, isStandalone: false, selector: "rdt-menu", inputs: { trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: true, transformFunction: null },
|
|
1310
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: RdtMenuComponent, isStandalone: false, selector: "rdt-menu", inputs: { trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: true, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
|
|
1312
1311
|
{
|
|
1313
1312
|
provide: RdtMenuBaseComponent,
|
|
1314
1313
|
useExisting: RdtMenuComponent,
|