Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): mouseover disabled sub-menu shouldn't open it #1167

Merged
merged 1 commit into from
Oct 31, 2023
Merged
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
7 changes: 0 additions & 7 deletions packages/common/src/extensions/menuBaseClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,6 @@ export class MenuBaseClass<M extends CellMenu | ContextMenu | GridMenu | HeaderM
undefined,
eventGroupName
);
// this._bindEventService.bind(commandLiElm, 'mouseover', ((e: DOMMouseOrTouchEvent<HTMLDivElement>) => {
// if ((item as MenuCommandItem).commandItems || (item as MenuOptionItem).optionItems || (item as HeaderMenuCommandItem).items) {
// (this as any).repositionSubMenu(item, itemType, args.level, e);
// } else if (level === 0) {
// this.disposeSubMenus();
// }
// }) as EventListener);
}

// the option/command item could be a sub-menu if it has another list of commands/options
Expand Down
12 changes: 7 additions & 5 deletions packages/common/src/extensions/menuFromCellBaseClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,13 @@ export class MenuFromCellBaseClass<M extends CellMenu | ContextMenu> extends Men
}

protected handleMenuItemMouseOver(e: DOMMouseOrTouchEvent<HTMLElement>, type: MenuType, item: ExtractMenuType<ExtendableItemTypes, MenuType>, level = 0) {
if ((item as MenuCommandItem).commandItems || (item as MenuOptionItem).optionItems || (item as HeaderMenuCommandItem).items) {
this.repositionSubMenu(item, type, level, e);
this._lastMenuTypeClicked = type;
} else if (level === 0) {
this.disposeSubMenus();
if ((item as never)?.[type] !== undefined && item !== 'divider' && !item.disabled && !(item as MenuCommandItem | MenuOptionItem).divider) {
if ((item as MenuCommandItem).commandItems || (item as MenuOptionItem).optionItems || (item as HeaderMenuCommandItem).items) {
this.repositionSubMenu(item, type, level, e);
this._lastMenuTypeClicked = type;
} else if (level === 0) {
this.disposeSubMenus();
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions packages/common/src/extensions/slickGridMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,12 @@ export class SlickGridMenu extends MenuBaseClass<GridMenu> {
}

protected handleMenuItemMouseOver(e: DOMMouseOrTouchEvent<HTMLElement>, _type: MenuType, item: ExtractMenuType<ExtendableItemTypes, MenuType>, level = 0) {
if ((item as GridMenuItem).commandItems) {
this.repositionSubMenu(e, item, level);
} else if (level === 0) {
this.disposeSubMenus();
if (item !== 'divider' && !item.disabled && !(item as GridMenuItem).divider) {
if ((item as GridMenuItem).commandItems) {
this.repositionSubMenu(e, item, level);
} else if (level === 0) {
this.disposeSubMenus();
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions packages/common/src/extensions/slickHeaderMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,12 @@ export class SlickHeaderMenu extends MenuBaseClass<HeaderMenu> {
}

protected handleMenuItemMouseOver(e: DOMMouseOrTouchEvent<HTMLElement>, _type: MenuType, item: ExtractMenuType<ExtendableItemTypes, MenuType>, level = 0, columnDef?: Column) {
if ((item as HeaderMenuCommandItem).commandItems || (item as HeaderMenuCommandItem).items) {
this.repositionSubMenu(e, item as HeaderMenuCommandItem, level, columnDef as Column);
} else if (level === 0) {
this.disposeSubMenus();
if (item !== 'divider' && !item.disabled && !(item as HeaderMenuCommandItem).divider) {
if ((item as HeaderMenuCommandItem).commandItems || (item as HeaderMenuCommandItem).items) {
this.repositionSubMenu(e, item as HeaderMenuCommandItem, level, columnDef as Column);
} else if (level === 0) {
this.disposeSubMenus();
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion packages/common/src/global-grid-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const GlobalGridOptions: GridOption = {
hideCommandSection: false,
hideOptionSection: false,
showBulletWhenIconMissing: true,
subItemChevronClass: 'mdi mdi-chevron-down mdi-rotate-270',
},
compositeEditorOptions: {
labels: {
Expand Down Expand Up @@ -77,6 +78,7 @@ export const GlobalGridOptions: GridOption = {
iconExportExcelCommand: 'fa fa-file-excel-o mdi mdi-file-excel-outline',
iconExportTextDelimitedCommand: 'fa fa-download mdi mdi-download',
showBulletWhenIconMissing: true,
subItemChevronClass: 'mdi mdi-chevron-down mdi-rotate-270',
},
customFooterOptions: {
dateFormat: 'YYYY-MM-DD, hh:mm a',
Expand Down Expand Up @@ -211,6 +213,7 @@ export const GlobalGridOptions: GridOption = {
menuWidth: 16,
resizeOnShowHeaderRow: true,
showBulletWhenIconMissing: true,
subItemChevronClass: 'mdi mdi-chevron-down mdi-rotate-270',
headerColumnValueExtractor: pickerHeaderColumnValueExtractor
},
headerMenu: {
Expand All @@ -229,7 +232,8 @@ export const GlobalGridOptions: GridOption = {
hideClearFilterCommand: false,
hideClearSortCommand: false,
hideFreezeColumnsCommand: true, // opt-in command
hideSortCommands: false
hideSortCommands: false,
subItemChevronClass: 'mdi mdi-chevron-down mdi-rotate-270',
},
ignoreAccentOnStringFilterAndSort: false,
multiColumnSort: true,
Expand Down