@fundamental-ngx/ui5-webcomponents-base 0.64.2-rc.13 → 0.64.2-rc.14
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.
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, DestroyRef, Directive } from '@angular/core';
|
|
3
|
+
import { Router, RouterLink } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Enables in-app (SPA) navigation for `[routerLink]` on UI5 wrapper components.
|
|
7
|
+
*
|
|
8
|
+
* UI5 replaces the native click with a `CustomEvent` that has no `button` property.
|
|
9
|
+
* Angular's `RouterLink` reads `event.button`, gets `undefined`, and bails — leaving
|
|
10
|
+
* the shadow `<a href>` to navigate natively. This directive intercepts the event in
|
|
11
|
+
* capture phase, handles plain left-clicks via `router.navigateByUrl()`, and blocks
|
|
12
|
+
* RouterLink from seeing modifier/middle clicks via `stopImmediatePropagation()`.
|
|
13
|
+
*
|
|
14
|
+
* Applied automatically via `hostDirectives` on generated wrappers with an `href` input.
|
|
15
|
+
* See `libs/webc-generator/src/executors/generate/component-template.ts`.
|
|
16
|
+
*/
|
|
17
|
+
class Ui5RouterLinkBridgeDirective {
|
|
18
|
+
constructor() {
|
|
19
|
+
this._router = inject(Router);
|
|
20
|
+
this._routerLink = inject(RouterLink, { optional: true, self: true });
|
|
21
|
+
this._elementRef = inject((ElementRef));
|
|
22
|
+
this._destroyRef = inject(DestroyRef);
|
|
23
|
+
}
|
|
24
|
+
ngOnInit() {
|
|
25
|
+
const routerLink = this._routerLink;
|
|
26
|
+
if (!routerLink) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const el = this._elementRef.nativeElement;
|
|
30
|
+
const handler = (event) => this._handleClick(event, routerLink);
|
|
31
|
+
el.addEventListener('click', handler, true);
|
|
32
|
+
this._destroyRef.onDestroy(() => el.removeEventListener('click', handler, true));
|
|
33
|
+
}
|
|
34
|
+
_handleClick(event, routerLink) {
|
|
35
|
+
const detail = event.detail ?? {};
|
|
36
|
+
const button = detail.button ?? 0;
|
|
37
|
+
const isModified = detail.ctrlKey || detail.metaKey || detail.shiftKey || detail.altKey;
|
|
38
|
+
if (button !== 0 || isModified) {
|
|
39
|
+
// Prevent RouterLink from seeing this event — RouterLink reads event.button as
|
|
40
|
+
// undefined on UI5 CustomEvents and would navigate regardless of modifier state.
|
|
41
|
+
event.stopImmediatePropagation();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const urlTree = routerLink.urlTree;
|
|
45
|
+
if (urlTree === null) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
this._router.navigateByUrl(urlTree);
|
|
50
|
+
}
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Ui5RouterLinkBridgeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
52
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: Ui5RouterLinkBridgeDirective, isStandalone: true, selector: "[ui5RouterLinkBridge]", ngImport: i0 }); }
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Ui5RouterLinkBridgeDirective, decorators: [{
|
|
55
|
+
type: Directive,
|
|
56
|
+
args: [{
|
|
57
|
+
selector: '[ui5RouterLinkBridge]'
|
|
58
|
+
}]
|
|
59
|
+
}] });
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Generated bundle index. Do not edit.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
export { Ui5RouterLinkBridgeDirective };
|
|
66
|
+
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-base-router-link.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-base-router-link.mjs","sources":["../../../../libs/ui5-webcomponents-base/router-link/ui5-router-link-bridge.directive.ts","../../../../libs/ui5-webcomponents-base/router-link/fundamental-ngx-ui5-webcomponents-base-router-link.ts"],"sourcesContent":["import { DestroyRef, Directive, ElementRef, inject, OnInit } from '@angular/core';\nimport { Router, RouterLink } from '@angular/router';\n\n/**\n * Enables in-app (SPA) navigation for `[routerLink]` on UI5 wrapper components.\n *\n * UI5 replaces the native click with a `CustomEvent` that has no `button` property.\n * Angular's `RouterLink` reads `event.button`, gets `undefined`, and bails — leaving\n * the shadow `<a href>` to navigate natively. This directive intercepts the event in\n * capture phase, handles plain left-clicks via `router.navigateByUrl()`, and blocks\n * RouterLink from seeing modifier/middle clicks via `stopImmediatePropagation()`.\n *\n * Applied automatically via `hostDirectives` on generated wrappers with an `href` input.\n * See `libs/webc-generator/src/executors/generate/component-template.ts`.\n */\n@Directive({\n selector: '[ui5RouterLinkBridge]'\n})\nexport class Ui5RouterLinkBridgeDirective implements OnInit {\n private readonly _router = inject(Router);\n private readonly _routerLink = inject(RouterLink, { optional: true, self: true });\n private readonly _elementRef = inject(ElementRef<HTMLElement>);\n private readonly _destroyRef = inject(DestroyRef);\n\n ngOnInit(): void {\n const routerLink = this._routerLink;\n if (!routerLink) {\n return;\n }\n const el = this._elementRef.nativeElement;\n const handler = (event: Event): void => this._handleClick(event as CustomEvent, routerLink);\n el.addEventListener('click', handler, true);\n this._destroyRef.onDestroy(() => el.removeEventListener('click', handler, true));\n }\n\n private _handleClick(event: CustomEvent, routerLink: RouterLink): void {\n const detail = event.detail ?? {};\n const button = detail.button ?? 0;\n const isModified = detail.ctrlKey || detail.metaKey || detail.shiftKey || detail.altKey;\n\n if (button !== 0 || isModified) {\n // Prevent RouterLink from seeing this event — RouterLink reads event.button as\n // undefined on UI5 CustomEvents and would navigate regardless of modifier state.\n event.stopImmediatePropagation();\n return;\n }\n\n const urlTree = routerLink.urlTree;\n if (urlTree === null) {\n return;\n }\n\n event.preventDefault();\n this._router.navigateByUrl(urlTree);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;;;AAWG;MAIU,4BAA4B,CAAA;AAHzC,IAAA,WAAA,GAAA;AAIqB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;AACxB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAChE,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,EAAC,UAAuB,EAAC;AAC7C,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAiCpD,IAAA;IA/BG,QAAQ,GAAA;AACJ,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW;QACnC,IAAI,CAAC,UAAU,EAAE;YACb;QACJ;AACA,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa;AACzC,QAAA,MAAM,OAAO,GAAG,CAAC,KAAY,KAAW,IAAI,CAAC,YAAY,CAAC,KAAoB,EAAE,UAAU,CAAC;QAC3F,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC;AAC3C,QAAA,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACpF;IAEQ,YAAY,CAAC,KAAkB,EAAE,UAAsB,EAAA;AAC3D,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE;AACjC,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC;AACjC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAM;AAEvF,QAAA,IAAI,MAAM,KAAK,CAAC,IAAI,UAAU,EAAE;;;YAG5B,KAAK,CAAC,wBAAwB,EAAE;YAChC;QACJ;AAEA,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO;AAClC,QAAA,IAAI,OAAO,KAAK,IAAI,EAAE;YAClB;QACJ;QAEA,KAAK,CAAC,cAAc,EAAE;AACtB,QAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC;IACvC;8GApCS,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA5B,4BAA4B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBAHxC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;;;ACjBD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fundamental-ngx/ui5-webcomponents-base",
|
|
3
|
-
"version": "0.64.2-rc.
|
|
3
|
+
"version": "0.64.2-rc.14",
|
|
4
4
|
"schematics": "./schematics/collection.json",
|
|
5
5
|
"description": "Official SAP Angular base library for UI5 Web Component wrappers – part of the Fundamental Library for Angular.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@angular/forms": "^22.0.0",
|
|
39
39
|
"@angular/platform-browser": "^22.0.0",
|
|
40
40
|
"@angular/router": "^22.0.0",
|
|
41
|
-
"@fundamental-ngx/core": "0.64.2-rc.
|
|
42
|
-
"@fundamental-ngx/i18n": "0.64.2-rc.
|
|
41
|
+
"@fundamental-ngx/core": "0.64.2-rc.14",
|
|
42
|
+
"@fundamental-ngx/i18n": "0.64.2-rc.14",
|
|
43
43
|
"@ui5/webcomponents-base": "^2.25.0",
|
|
44
44
|
"fundamental-styles": "0.41.8",
|
|
45
45
|
"rxjs": "^7.8.0"
|
|
@@ -72,6 +72,10 @@
|
|
|
72
72
|
"types": "./types/fundamental-ngx-ui5-webcomponents-base-i18n.d.ts",
|
|
73
73
|
"default": "./fesm2022/fundamental-ngx-ui5-webcomponents-base-i18n.mjs"
|
|
74
74
|
},
|
|
75
|
+
"./router-link": {
|
|
76
|
+
"types": "./types/fundamental-ngx-ui5-webcomponents-base-router-link.d.ts",
|
|
77
|
+
"default": "./fesm2022/fundamental-ngx-ui5-webcomponents-base-router-link.mjs"
|
|
78
|
+
},
|
|
75
79
|
"./theming": {
|
|
76
80
|
"types": "./types/fundamental-ngx-ui5-webcomponents-base-theming.d.ts",
|
|
77
81
|
"default": "./fesm2022/fundamental-ngx-ui5-webcomponents-base-theming.mjs"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enables in-app (SPA) navigation for `[routerLink]` on UI5 wrapper components.
|
|
6
|
+
*
|
|
7
|
+
* UI5 replaces the native click with a `CustomEvent` that has no `button` property.
|
|
8
|
+
* Angular's `RouterLink` reads `event.button`, gets `undefined`, and bails — leaving
|
|
9
|
+
* the shadow `<a href>` to navigate natively. This directive intercepts the event in
|
|
10
|
+
* capture phase, handles plain left-clicks via `router.navigateByUrl()`, and blocks
|
|
11
|
+
* RouterLink from seeing modifier/middle clicks via `stopImmediatePropagation()`.
|
|
12
|
+
*
|
|
13
|
+
* Applied automatically via `hostDirectives` on generated wrappers with an `href` input.
|
|
14
|
+
* See `libs/webc-generator/src/executors/generate/component-template.ts`.
|
|
15
|
+
*/
|
|
16
|
+
declare class Ui5RouterLinkBridgeDirective implements OnInit {
|
|
17
|
+
private readonly _router;
|
|
18
|
+
private readonly _routerLink;
|
|
19
|
+
private readonly _elementRef;
|
|
20
|
+
private readonly _destroyRef;
|
|
21
|
+
ngOnInit(): void;
|
|
22
|
+
private _handleClick;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Ui5RouterLinkBridgeDirective, never>;
|
|
24
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<Ui5RouterLinkBridgeDirective, "[ui5RouterLinkBridge]", never, {}, {}, never, never, true, never>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Ui5RouterLinkBridgeDirective };
|