Skip to content

Commit 8435dd2

Browse files
fix(uxc-integration): Enabled .d.ts generation for seamless wrappers
1 parent cced45b commit 8435dd2

4 files changed

Lines changed: 20 additions & 21 deletions

File tree

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"./webapp/test/e2e/**/*"
3030
],
3131
"include": [
32-
"./webapp/**/*"
32+
"./webapp/**/*",
33+
"./.ui5-tooling-modules/types/**/*.d.ts"
3334
]
3435
}

ui5.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@ server:
2727
afterMiddleware: compression
2828
- name: ui5-tooling-modules-middleware
2929
afterMiddleware: ui5-tooling-transpile-middleware
30+
configuration:
31+
persistentCache: false
32+
pluginOptions:
33+
webcomponents:
34+
skipDtsGeneration: false
3035
- name: ui5-middleware-livereload
3136
afterMiddleware: compression

webapp/controller/App.controller.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-call */
1+
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
22
import BaseController from "uxc/integration/controller/BaseController";
33
import UI5Element from "sap/ui/core/Element";
44
import Device from "sap/ui/Device";
@@ -18,9 +18,9 @@ import NavigationListItem from "sap/tnt/NavigationListItem";
1818
// UI5 Web Components
1919
import WebCButton from "@ui5/webcomponents/dist/Button";
2020
import WebCPopover from "@ui5/webcomponents/dist/Popover";
21-
import WebCFUserMenu, { UserMenuItemClickEventDetail } from "@ui5/webcomponents-fiori/dist/UserMenu";
21+
import WebCFUserMenu, { UserMenu$ItemClickEvent } from "@ui5/webcomponents-fiori/dist/UserMenu";
2222
import WebCFUserSettingsDialog from "@ui5/webcomponents-fiori/dist/UserSettingsDialog";
23-
import { ShellBar$NotificationsClickEvent, ShellBar$ProfileClickEvent } from "sap/ui/webc/fiori/ShellBar";
23+
import { ShellBar$NotificationsClickEvent, ShellBar$ProfileClickEvent } from "@ui5/webcomponents-fiori/dist/ShellBar";
2424

2525
// Icons
2626
import "@ui5/webcomponents-icons/dist/menu2";
@@ -109,7 +109,7 @@ export default class App extends BaseController {
109109
const toolPage = this.getView().byId("toolPage") as ToolPage;
110110
toolPage.setSideExpanded(!toolPage.getSideExpanded());
111111
} else {
112-
const menuButton = this.getView().byId("toggleMenu").getDomRef() as WebCButton;
112+
const menuButton = this.getView().byId("toggleMenu") as unknown as WebCButton;
113113
await this.openNavigationInOverlay(menuButton);
114114
}
115115
}
@@ -166,23 +166,23 @@ export default class App extends BaseController {
166166
*/
167167
onNotificationsClick(e: ShellBar$NotificationsClickEvent): void {
168168
const view = this.getView().byId("notificationsView") as XMLView;
169-
const popover = view.byId("notificationsPopover").getDomRef() as WebCPopover;
169+
const popover = view.byId("notificationsPopover") as unknown as WebCPopover;
170170

171171
e.preventDefault();
172-
popover.opener = e.getParameter("targetRef");
173-
popover.open = true;
172+
popover.setOpener(e.getParameter("targetRef"));
173+
popover.setOpen(true);
174174
}
175175

176176
/**
177177
* Called when the user clicks on the profile button.
178178
* This is used to open the user menu and setup the settings dialog.
179179
*/
180180
async onProfileClick(e: ShellBar$ProfileClickEvent): Promise<void> {
181-
const userMenu = this.getView().byId("userProfileMenu").getDomRef() as WebCFUserMenu;
181+
const userMenu = this.getView().byId("userProfileMenu") as unknown as WebCFUserMenu;
182182

183183
// Use the targetRef from the event as the opener
184-
userMenu.opener = e.getParameter("targetRef");
185-
userMenu.open = true;
184+
userMenu.setOpener(e.getParameter("targetRef"));
185+
userMenu.setOpen(true);
186186

187187
// Load the settings dialog if not already loaded
188188
let settingsDialog = this.getView().byId("settings") as unknown as WebCFUserSettingsDialog;
@@ -199,16 +199,13 @@ export default class App extends BaseController {
199199

200200
// Add event listener for user menu item clicks if not already added
201201
if (!this.userMenuListenerAdded) {
202-
userMenu.addEventListener("item-click", (event: Event) => {
203-
const customEvent = event as CustomEvent<UserMenuItemClickEventDetail>;
204-
const item = customEvent.detail?.item.text;
202+
userMenu.attachItemClick((event: UserMenu$ItemClickEvent) => {
203+
const item = event.getParameter("item");
205204
const settingsDialog = this.getView().byId("userSettingsDialog--settings") as unknown as WebCFUserSettingsDialog;
206205

207-
switch (item) {
206+
switch (item?.getText()) {
208207
case "Setting":
209-
// @ts-expect-error: getOpen is not in the type but exists at runtime
210208
if (!settingsDialog.getOpen()) {
211-
// @ts-expect-error: setOpen is not in the type but exists at runtime
212209
settingsDialog.setOpen(true);
213210
}
214211
}

webapp/controller/Notifications.controller.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@ export default class Notifications extends BaseController {
2222
const oNotificationList = oView.byId("notificationsPopoverList") as unknown as WebCFNotificationList;
2323
const oEmptyMessage = oView.byId("emptyNotificationsMessage") as unknown as WebCFIllustratedMessage;
2424

25-
// @ts-expect-error: WebCFNotificationList does not have a setVisible method
2625
if (oNotificationList && oNotificationList.setVisible) {
27-
// @ts-expect-error: WebCFNotificationList does not have a setVisible method
2826
oNotificationList.setVisible(false);
2927
}
3028

31-
// @ts-expect-error: WebCFIllustratedMessage does not have a setVisible method
3229
if (oEmptyMessage && oEmptyMessage.setVisible) {
33-
// @ts-expect-error: WebCFIllustratedMessage does not have a setVisible method
3430
oEmptyMessage.setVisible(true);
3531
}
3632

0 commit comments

Comments
 (0)