Skip to content

Commit

Permalink
work for #8129 Popup submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaLarina committed May 15, 2024
1 parent 23996a0 commit fe96be4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
14 changes: 9 additions & 5 deletions src/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,18 @@ export class Action extends BaseAction implements IAction, ILocalizableOwner {
this.markerIconName = "icon-next_16x16";
this.component = "sv-list-item-group";
this.items = [...items];
const { innerPopupModel, listModel }: { innerPopupModel: PopupModel<any>, listModel: ListModel<Action> } =
const { popupModel, listModel }: { popupModel: PopupModel<any>, listModel: ListModel<Action> } =
createPopupModelWithListModel(
{ items: items, onSelectionChanged: onSelectionChanged },
{ items: items, onSelectionChanged: onSelectionChanged, searchEnabled: false },
{ horizontalPosition: "right", showPointer: false }
);
innerPopupModel.cssClass = "sv-popup-inner";
listModel.searchEnabled = false;
this.popupModel = innerPopupModel;
popupModel.cssClass = "sv-popup-inner";
this.popupModel = popupModel;
const originalAction = this.action;
this.action = (context?: any, isUserAction?: boolean) => {
if (!!originalAction) originalAction(context, isUserAction);
this.hidePopup();
};
}

location?: string;
Expand Down
9 changes: 3 additions & 6 deletions src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,12 @@ export class ListModel<T extends BaseAction = Action> extends ActionContainer<T>
public onItemHover = (itemValue: T): void => {
this.actions.forEach(action => {
if (action === itemValue && !!itemValue.popupModel) {
itemValue.popupModel.isVisible = true;
itemValue.showPopup();
this.addScrollEventListener(() => {
itemValue.popupModel.isVisible = false;
itemValue.hidePopup();
});
// itemValue.popupModel.isFocusedContent = !isUserAction || listModel.showFilter;
// itemValue.popupModel.toggleVisibility();
// listModel.scrollToSelectedItem();
} else if (!!action.popupModel && action.popupModel.isVisible) {
action.popupModel.isVisible = false;
itemValue.hidePopup();
}
});
}
Expand Down

0 comments on commit fe96be4

Please sign in to comment.