Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"./webapp/test/e2e/**/*"
],
"include": [
"./webapp/**/*"
"./webapp/**/*",
"./.ui5-tooling-modules/types/**/*.d.ts"
]
}
5 changes: 5 additions & 0 deletions ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ server:
afterMiddleware: compression
- name: ui5-tooling-modules-middleware
afterMiddleware: ui5-tooling-transpile-middleware
configuration:
persistentCache: false
pluginOptions:
webcomponents:
skipDtsGeneration: false
- name: ui5-middleware-livereload
afterMiddleware: compression
29 changes: 13 additions & 16 deletions webapp/controller/App.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */
import BaseController from "uxc/integration/controller/BaseController";
import UI5Element from "sap/ui/core/Element";
import Device from "sap/ui/Device";
Expand All @@ -18,9 +18,9 @@ import NavigationListItem from "sap/tnt/NavigationListItem";
// UI5 Web Components
import WebCButton from "@ui5/webcomponents/dist/Button";
import WebCPopover from "@ui5/webcomponents/dist/Popover";
import WebCFUserMenu, { UserMenuItemClickEventDetail } from "@ui5/webcomponents-fiori/dist/UserMenu";
import WebCFUserMenu, { UserMenu$ItemClickEvent } from "@ui5/webcomponents-fiori/dist/UserMenu";
import WebCFUserSettingsDialog from "@ui5/webcomponents-fiori/dist/UserSettingsDialog";
import { ShellBar$NotificationsClickEvent, ShellBar$ProfileClickEvent } from "sap/ui/webc/fiori/ShellBar";
import { ShellBar$NotificationsClickEvent, ShellBar$ProfileClickEvent } from "@ui5/webcomponents-fiori/dist/ShellBar";

// Icons
import "@ui5/webcomponents-icons/dist/menu2";
Expand Down Expand Up @@ -109,7 +109,7 @@ export default class App extends BaseController {
const toolPage = this.getView().byId("toolPage") as ToolPage;
toolPage.setSideExpanded(!toolPage.getSideExpanded());
} else {
const menuButton = this.getView().byId("toggleMenu").getDomRef() as WebCButton;
const menuButton = this.getView().byId("toggleMenu") as unknown as WebCButton;
await this.openNavigationInOverlay(menuButton);
}
}
Expand Down Expand Up @@ -166,23 +166,23 @@ export default class App extends BaseController {
*/
onNotificationsClick(e: ShellBar$NotificationsClickEvent): void {
const view = this.getView().byId("notificationsView") as XMLView;
const popover = view.byId("notificationsPopover").getDomRef() as WebCPopover;
const popover = view.byId("notificationsPopover") as unknown as WebCPopover;

e.preventDefault();
popover.opener = e.getParameter("targetRef");
popover.open = true;
popover.setOpener(e.getParameter("targetRef"));
popover.setOpen(true);
}

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

// Use the targetRef from the event as the opener
userMenu.opener = e.getParameter("targetRef");
userMenu.open = true;
userMenu.setOpener(e.getParameter("targetRef"));
userMenu.setOpen(true);

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

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

switch (item) {
switch (item?.getText()) {
case "Setting":
// @ts-expect-error: getOpen is not in the type but exists at runtime
if (!settingsDialog.getOpen()) {
// @ts-expect-error: setOpen is not in the type but exists at runtime
settingsDialog.setOpen(true);
}
}
Expand Down
4 changes: 0 additions & 4 deletions webapp/controller/Notifications.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ export default class Notifications extends BaseController {
const oNotificationList = oView.byId("notificationsPopoverList") as unknown as WebCFNotificationList;
const oEmptyMessage = oView.byId("emptyNotificationsMessage") as unknown as WebCFIllustratedMessage;

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

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

Expand Down