@ag-grid-enterprise/menu
Advanced tools
Comparing version 25.3.0 to 26.0.0
@@ -1,9 +0,8 @@ | ||
import { BeanStub, Column, GridBodyComp, IContextMenuFactory, RowNode } from "@ag-grid-community/core"; | ||
import { BeanStub, Column, IContextMenuFactory, RowNode } from "@ag-grid-community/core"; | ||
export declare class ContextMenuFactory extends BeanStub implements IContextMenuFactory { | ||
private popupService; | ||
private rangeController; | ||
private columnController; | ||
private rangeService; | ||
private ctrlsService; | ||
private columnModel; | ||
private activeMenu; | ||
private gridBodyComp; | ||
registerGridComp(gridBodyComp: GridBodyComp): void; | ||
hideActiveMenu(): void; | ||
@@ -10,0 +9,0 @@ private getMenuItems; |
@@ -32,5 +32,2 @@ "use strict"; | ||
} | ||
ContextMenuFactory.prototype.registerGridComp = function (gridBodyComp) { | ||
this.gridBodyComp = gridBodyComp; | ||
}; | ||
ContextMenuFactory.prototype.hideActiveMenu = function () { | ||
@@ -50,6 +47,6 @@ this.destroyBean(this.activeMenu); | ||
core_1.ModuleRegistry.isRegistered(core_1.ModuleNames.GridChartsModule)) { | ||
if (this.columnController.isPivotMode()) { | ||
if (this.columnModel.isPivotMode()) { | ||
defaultMenuOptions.push('pivotChart'); | ||
} | ||
if (this.rangeController && !this.rangeController.isEmpty()) { | ||
if (this.rangeService && !this.rangeService.isEmpty()) { | ||
defaultMenuOptions.push('chartRange'); | ||
@@ -94,2 +91,7 @@ } | ||
} | ||
// need to do this regardless of context menu showing or not, so doing | ||
// before the isSuppressContextMenu() check | ||
if (mouseEvent) { | ||
this.preventDefaultOnContextMenu(mouseEvent); | ||
} | ||
if (this.gridOptionsWrapper.isSuppressContextMenu()) { | ||
@@ -103,5 +105,2 @@ return; | ||
} | ||
if (mouseEvent) { | ||
this.preventDefaultOnContextMenu(mouseEvent); | ||
} | ||
}; | ||
@@ -123,3 +122,3 @@ ContextMenuFactory.prototype.preventDefaultOnContextMenu = function (mouseEvent) { | ||
var menuItems = this.getMenuItems(node, column, value); | ||
var eGridBodyGui = this.gridBodyComp.getGui(); | ||
var eGridBodyGui = this.ctrlsService.getGridBodyCtrl().getGui(); | ||
if (menuItems === undefined || core_1._.missingOrEmpty(menuItems)) { | ||
@@ -139,6 +138,4 @@ return false; | ||
// won't show the browser's contextmenu | ||
nudgeX: 1, | ||
nudgeY: 1 | ||
}; | ||
var positionCallback = this.popupService.positionPopupUnderMouseEvent.bind(this.popupService, positionParams); | ||
var addPopupRes = this.popupService.addPopup({ | ||
@@ -153,3 +150,7 @@ modal: true, | ||
click: mouseEvent, | ||
positionCallback: positionCallback, | ||
positionCallback: function () { | ||
_this.popupService.positionPopupUnderMouseEvent(core_1._.assign({}, { | ||
nudgeX: _this.gridOptionsWrapper.isEnableRtl() ? (eMenuGui.offsetWidth + 1) * -1 : 1 | ||
}, positionParams)); | ||
}, | ||
// so when browser is scrolled down, or grid is scrolled, context menu stays with cell | ||
@@ -186,7 +187,10 @@ anchorToElement: anchorToElement | ||
__decorate([ | ||
core_1.Optional('rangeController') | ||
], ContextMenuFactory.prototype, "rangeController", void 0); | ||
core_1.Optional('rangeService') | ||
], ContextMenuFactory.prototype, "rangeService", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnController') | ||
], ContextMenuFactory.prototype, "columnController", void 0); | ||
core_1.Autowired('ctrlsService') | ||
], ContextMenuFactory.prototype, "ctrlsService", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
], ContextMenuFactory.prototype, "columnModel", void 0); | ||
ContextMenuFactory = __decorate([ | ||
@@ -220,9 +224,9 @@ core_1.Bean('contextMenuFactory') | ||
} | ||
this.focusedCell = this.focusController.getFocusedCell(); | ||
this.focusedCell = this.focusService.getFocusedCell(); | ||
if (this.menuList) { | ||
this.focusController.focusInto(this.menuList.getGui()); | ||
this.focusService.focusInto(this.menuList.getGui()); | ||
} | ||
}; | ||
ContextMenu.prototype.restoreFocusedCell = function () { | ||
var currentFocusedCell = this.focusController.getFocusedCell(); | ||
var currentFocusedCell = this.focusService.getFocusedCell(); | ||
if (currentFocusedCell && this.focusedCell && this.cellPositionUtils.equals(currentFocusedCell, this.focusedCell)) { | ||
@@ -232,3 +236,3 @@ var _a = this.focusedCell, rowIndex = _a.rowIndex, rowPinned = _a.rowPinned, column = _a.column; | ||
if (doc.activeElement === doc.body) { | ||
this.focusController.setFocusedCell(rowIndex, column, rowPinned, true); | ||
this.focusService.setFocusedCell(rowIndex, column, rowPinned, true); | ||
} | ||
@@ -245,4 +249,4 @@ } | ||
__decorate([ | ||
core_1.Autowired('focusController') | ||
], ContextMenu.prototype, "focusController", void 0); | ||
core_1.Autowired('focusService') | ||
], ContextMenu.prototype, "focusService", void 0); | ||
__decorate([ | ||
@@ -249,0 +253,0 @@ core_1.Autowired('cellPositionUtils') |
@@ -1,3 +0,2 @@ | ||
import { AgEvent, BeanStub, Column, IMenuFactory, GridBodyComp } from '@ag-grid-community/core'; | ||
import { AfterGuiAttachedParams } from '@ag-grid-community/core/dist/cjs/widgets/popupService'; | ||
import { AgEvent, BeanStub, Column, IMenuFactory, IAfterGuiAttachedParams, ContainerType } from '@ag-grid-community/core'; | ||
export interface TabSelectedEvent extends AgEvent { | ||
@@ -8,11 +7,10 @@ key: string; | ||
private popupService; | ||
private focusController; | ||
private focusService; | ||
private ctrlsService; | ||
private lastSelectedTab; | ||
private activeMenu; | ||
private gridBodyComp; | ||
registerGridComp(gridBodyComp: GridBodyComp): void; | ||
hideActiveMenu(): void; | ||
showMenuAfterMouseEvent(column: Column, mouseEvent: MouseEvent, defaultTab?: string): void; | ||
showMenuAfterButtonClick(column: Column, eventSource: HTMLElement, defaultTab?: string, restrictToTabs?: string[]): void; | ||
showMenu(column: Column, positionCallback: (menu: EnterpriseMenu) => void, defaultTab?: string, restrictToTabs?: string[], eventSource?: HTMLElement): void; | ||
showMenuAfterButtonClick(column: Column, eventSource: HTMLElement, containerType: ContainerType, defaultTab?: string, restrictToTabs?: string[]): void; | ||
showMenu(column: Column, positionCallback: (menu: EnterpriseMenu) => void, containerType: ContainerType, defaultTab?: string, restrictToTabs?: string[], eventSource?: HTMLElement): void; | ||
isMenuEnabled(column: Column): boolean; | ||
@@ -27,3 +25,3 @@ } | ||
static MENU_ITEM_SEPARATOR: string; | ||
private columnController; | ||
private columnModel; | ||
private filterManager; | ||
@@ -34,3 +32,3 @@ private gridApi; | ||
private rowModel; | ||
private focusController; | ||
private focusService; | ||
private tabbedLayout; | ||
@@ -48,8 +46,3 @@ private hidePopupFunc; | ||
private restrictTo?; | ||
private timeOfLastColumnChange; | ||
constructor(column: Column, initialSelection: string, restrictTo?: string[]); | ||
getMinDimensions(): { | ||
width: number; | ||
height: number; | ||
}; | ||
init(): void; | ||
@@ -71,5 +64,4 @@ private getTabsToCreate; | ||
private createColumnsPanel; | ||
afterGuiAttached(params: AfterGuiAttachedParams): void; | ||
afterGuiAttached(params: IAfterGuiAttachedParams): void; | ||
getGui(): HTMLElement; | ||
private onDisplayedColumnsChanged; | ||
} |
@@ -31,5 +31,2 @@ "use strict"; | ||
} | ||
EnterpriseMenuFactory.prototype.registerGridComp = function (gridBodyComp) { | ||
this.gridBodyComp = gridBodyComp; | ||
}; | ||
EnterpriseMenuFactory.prototype.hideActiveMenu = function () { | ||
@@ -51,5 +48,5 @@ this.destroyBean(this.activeMenu); | ||
} | ||
}, defaultTab, undefined, mouseEvent.target); | ||
}, 'columnMenu', defaultTab, undefined, mouseEvent.target); | ||
}; | ||
EnterpriseMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, defaultTab, restrictToTabs) { | ||
EnterpriseMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, containerType, defaultTab, restrictToTabs) { | ||
var _this = this; | ||
@@ -63,12 +60,8 @@ var multiplier = -1; | ||
this.showMenu(column, function (menu) { | ||
var minDims = menu.getMinDimensions(); | ||
var minWidth = minDims.width, minHeight = minDims.height; | ||
var ePopup = menu.getGui(); | ||
_this.popupService.positionPopupUnderComponent({ | ||
type: 'columnMenu', | ||
type: containerType, | ||
column: column, | ||
eventSource: eventSource, | ||
ePopup: ePopup, | ||
minWidth: minWidth, | ||
minHeight: minHeight, | ||
alignSide: alignSide, | ||
@@ -82,9 +75,9 @@ nudgeX: 9 * multiplier, | ||
} | ||
}, defaultTab, restrictToTabs, eventSource); | ||
}, containerType, defaultTab, restrictToTabs, eventSource); | ||
}; | ||
EnterpriseMenuFactory.prototype.showMenu = function (column, positionCallback, defaultTab, restrictToTabs, eventSource) { | ||
EnterpriseMenuFactory.prototype.showMenu = function (column, positionCallback, containerType, defaultTab, restrictToTabs, eventSource) { | ||
var _this = this; | ||
var menu = this.createBean(new EnterpriseMenu(column, this.lastSelectedTab, restrictToTabs)); | ||
var eMenuGui = menu.getGui(); | ||
var anchorToElement = eventSource || this.gridBodyComp.getGui(); | ||
var anchorToElement = eventSource || this.ctrlsService.getGridBodyCtrl().getGui(); | ||
var closedFuncs = []; | ||
@@ -96,3 +89,3 @@ closedFuncs.push(function (e) { | ||
if (isKeyboardEvent && eventSource && core_1._.isVisible(eventSource)) { | ||
var focusableEl = _this.focusController.findTabbableParent(eventSource); | ||
var focusableEl = _this.focusService.findTabbableParent(eventSource); | ||
if (focusableEl) { | ||
@@ -112,3 +105,3 @@ focusableEl.focus(); | ||
}, | ||
afterGuiAttached: function (params) { return menu.afterGuiAttached(params); }, | ||
afterGuiAttached: function (params) { return menu.afterGuiAttached(core_1._.assign({}, { container: containerType }, params)); }, | ||
positionCallback: function () { return positionCallback(menu); }, | ||
@@ -121,9 +114,11 @@ anchorToElement: anchorToElement | ||
// the menu would move as the user is using the columns tab inside the menu. | ||
var stopAnchoringFunc_1 = addPopupRes.stopAnchoringFunc; | ||
if (stopAnchoringFunc_1) { | ||
column.addEventListener(core_1.Column.EVENT_LEFT_CHANGED, stopAnchoringFunc_1); | ||
column.addEventListener(core_1.Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc_1); | ||
closedFuncs.push(function () { | ||
column.removeEventListener(core_1.Column.EVENT_LEFT_CHANGED, stopAnchoringFunc_1); | ||
column.removeEventListener(core_1.Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc_1); | ||
var stopAnchoringPromise = addPopupRes.stopAnchoringPromise; | ||
if (stopAnchoringPromise) { | ||
stopAnchoringPromise.then(function (stopAnchoringFunc) { | ||
column.addEventListener(core_1.Column.EVENT_LEFT_CHANGED, stopAnchoringFunc); | ||
column.addEventListener(core_1.Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc); | ||
closedFuncs.push(function () { | ||
column.removeEventListener(core_1.Column.EVENT_LEFT_CHANGED, stopAnchoringFunc); | ||
column.removeEventListener(core_1.Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc); | ||
}); | ||
}); | ||
@@ -134,2 +129,5 @@ } | ||
menu.showTabBasedOnPreviousSelection(); | ||
// reposition the menu because the method above could load | ||
// an element that is bigger than enterpriseMenu header. | ||
positionCallback(menu); | ||
} | ||
@@ -154,4 +152,7 @@ menu.addEventListener(EnterpriseMenu.EVENT_TAB_SELECTED, function (event) { | ||
__decorate([ | ||
core_1.Autowired('focusController') | ||
], EnterpriseMenuFactory.prototype, "focusController", void 0); | ||
core_1.Autowired('focusService') | ||
], EnterpriseMenuFactory.prototype, "focusService", void 0); | ||
__decorate([ | ||
core_1.Autowired('ctrlsService') | ||
], EnterpriseMenuFactory.prototype, "ctrlsService", void 0); | ||
EnterpriseMenuFactory = __decorate([ | ||
@@ -169,3 +170,2 @@ core_1.Bean('menuFactory') | ||
_this.includeChecks = {}; | ||
_this.timeOfLastColumnChange = Date.now(); | ||
_this.column = column; | ||
@@ -182,5 +182,2 @@ _this.initialSelection = initialSelection; | ||
} | ||
EnterpriseMenu.prototype.getMinDimensions = function () { | ||
return this.tabbedLayout.getMinDimensions(); | ||
}; | ||
EnterpriseMenu.prototype.init = function () { | ||
@@ -199,3 +196,2 @@ var _this = this; | ||
} | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this)); | ||
}; | ||
@@ -303,9 +299,9 @@ EnterpriseMenu.prototype.getTabsToCreate = function () { | ||
var allowPinning = !this.column.getColDef().lockPinned; | ||
var rowGroupCount = this.columnController.getRowGroupColumns().length; | ||
var rowGroupCount = this.columnModel.getRowGroupColumns().length; | ||
var doingGrouping = rowGroupCount > 0; | ||
var groupedByThisColumn = this.columnController.getRowGroupColumns().indexOf(this.column) >= 0; | ||
var groupedByThisColumn = this.columnModel.getRowGroupColumns().indexOf(this.column) >= 0; | ||
var allowValue = this.column.isAllowValue(); | ||
var allowRowGroup = this.column.isAllowRowGroup(); | ||
var isPrimary = this.column.isPrimary(); | ||
var pivotModeOn = this.columnController.isPivotMode(); | ||
var pivotModeOn = this.columnModel.isPivotMode(); | ||
var isInMemoryRowModel = this.rowModel.getType() === core_1.Constants.ROW_MODEL_TYPE_CLIENT_SIDE; | ||
@@ -369,6 +365,6 @@ var usingTreeData = this.gridOptionsWrapper.isTreeData(); | ||
// in this case we highlight the cell that was previously highlighted | ||
var focusedCell = this.focusController.getFocusedCell(); | ||
var focusedCell = this.focusService.getFocusedCell(); | ||
if (focusedCell) { | ||
var rowIndex = focusedCell.rowIndex, rowPinned = focusedCell.rowPinned, column = focusedCell.column; | ||
this.focusController.setFocusedCell(rowIndex, column, rowPinned, true); | ||
this.focusService.setFocusedCell(rowIndex, column, rowPinned, true); | ||
} | ||
@@ -433,6 +429,8 @@ }; | ||
EnterpriseMenu.prototype.afterGuiAttached = function (params) { | ||
var hidePopup = params.hidePopup; | ||
this.tabbedLayout.setAfterAttachedParams({ container: 'columnMenu', hidePopup: hidePopup }); | ||
this.hidePopupFunc = hidePopup; | ||
this.addDestroyFunc(hidePopup); | ||
var container = params.container, hidePopup = params.hidePopup; | ||
this.tabbedLayout.setAfterAttachedParams({ container: container, hidePopup: hidePopup }); | ||
if (hidePopup) { | ||
this.hidePopupFunc = hidePopup; | ||
this.addDestroyFunc(hidePopup); | ||
} | ||
}; | ||
@@ -442,5 +440,2 @@ EnterpriseMenu.prototype.getGui = function () { | ||
}; | ||
EnterpriseMenu.prototype.onDisplayedColumnsChanged = function () { | ||
this.timeOfLastColumnChange = Date.now(); | ||
}; | ||
EnterpriseMenu.EVENT_TAB_SELECTED = 'tabSelected'; | ||
@@ -453,4 +448,4 @@ EnterpriseMenu.TAB_FILTER = 'filterMenuTab'; | ||
__decorate([ | ||
core_1.Autowired('columnController') | ||
], EnterpriseMenu.prototype, "columnController", void 0); | ||
core_1.Autowired('columnModel') | ||
], EnterpriseMenu.prototype, "columnModel", void 0); | ||
__decorate([ | ||
@@ -472,4 +467,4 @@ core_1.Autowired('filterManager') | ||
__decorate([ | ||
core_1.Autowired('focusController') | ||
], EnterpriseMenu.prototype, "focusController", void 0); | ||
core_1.Autowired('focusService') | ||
], EnterpriseMenu.prototype, "focusService", void 0); | ||
__decorate([ | ||
@@ -476,0 +471,0 @@ core_1.PostConstruct |
import { BeanStub, Column, MenuItemDef } from '@ag-grid-community/core'; | ||
export declare class MenuItemMapper extends BeanStub { | ||
private columnController; | ||
private columnModel; | ||
private gridApi; | ||
@@ -5,0 +5,0 @@ private clipboardService; |
@@ -71,3 +71,3 @@ "use strict"; | ||
name: localeTextFunc('pinLeft', 'Pin Left'), | ||
action: function () { return _this.columnController.setColumnPinned(column, core_1.Constants.PINNED_LEFT, "contextMenu"); }, | ||
action: function () { return _this.columnModel.setColumnPinned(column, core_1.Constants.PINNED_LEFT, "contextMenu"); }, | ||
checked: !!column && column.isPinnedLeft() | ||
@@ -78,3 +78,3 @@ }; | ||
name: localeTextFunc('pinRight', 'Pin Right'), | ||
action: function () { return _this.columnController.setColumnPinned(column, core_1.Constants.PINNED_RIGHT, "contextMenu"); }, | ||
action: function () { return _this.columnModel.setColumnPinned(column, core_1.Constants.PINNED_RIGHT, "contextMenu"); }, | ||
checked: !!column && column.isPinnedRight() | ||
@@ -85,3 +85,3 @@ }; | ||
name: localeTextFunc('noPin', 'No Pin'), | ||
action: function () { return _this.columnController.setColumnPinned(column, null, "contextMenu"); }, | ||
action: function () { return _this.columnModel.setColumnPinned(column, null, "contextMenu"); }, | ||
checked: !!column && !column.isPinned() | ||
@@ -103,3 +103,3 @@ }; | ||
name: localeTextFunc('autosizeThiscolumn', 'Autosize This Column'), | ||
action: function () { return _this.columnController.autoSizeColumn(column, skipHeaderOnAutoSize, "contextMenu"); } | ||
action: function () { return _this.columnModel.autoSizeColumn(column, skipHeaderOnAutoSize, "contextMenu"); } | ||
}; | ||
@@ -109,8 +109,8 @@ case 'autoSizeAll': | ||
name: localeTextFunc('autosizeAllColumns', 'Autosize All Columns'), | ||
action: function () { return _this.columnController.autoSizeAllColumns(skipHeaderOnAutoSize, "contextMenu"); } | ||
action: function () { return _this.columnModel.autoSizeAllColumns(skipHeaderOnAutoSize, "contextMenu"); } | ||
}; | ||
case 'rowGroup': | ||
return { | ||
name: localeTextFunc('groupBy', 'Group by') + ' ' + core_1._.escapeString(this.columnController.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnController.addRowGroupColumn(column, "contextMenu"); }, | ||
name: localeTextFunc('groupBy', 'Group by') + ' ' + core_1._.escapeString(this.columnModel.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnModel.addRowGroupColumn(column, "contextMenu"); }, | ||
icon: core_1._.createIconNoSpan('menuAddRowGroup', this.gridOptionsWrapper, null) | ||
@@ -120,4 +120,4 @@ }; | ||
return { | ||
name: localeTextFunc('ungroupBy', 'Un-Group by') + ' ' + core_1._.escapeString(this.columnController.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnController.removeRowGroupColumn(column, "contextMenu"); }, | ||
name: localeTextFunc('ungroupBy', 'Un-Group by') + ' ' + core_1._.escapeString(this.columnModel.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnModel.removeRowGroupColumn(column, "contextMenu"); }, | ||
icon: core_1._.createIconNoSpan('menuRemoveRowGroup', this.gridOptionsWrapper, null) | ||
@@ -128,3 +128,3 @@ }; | ||
name: localeTextFunc('resetColumns', 'Reset Columns'), | ||
action: function () { return _this.columnController.resetColumnState("contextMenu"); } | ||
action: function () { return _this.columnModel.resetColumnState("contextMenu"); } | ||
}; | ||
@@ -397,4 +397,4 @@ case 'expandAll': | ||
action: function () { | ||
_this.columnController.setColumnAggFunc(columnToUse, funcName, "contextMenu"); | ||
_this.columnController.addValueColumn(columnToUse, "contextMenu"); | ||
_this.columnModel.setColumnAggFunc(columnToUse, funcName, "contextMenu"); | ||
_this.columnModel.addValueColumn(columnToUse, "contextMenu"); | ||
}, | ||
@@ -407,4 +407,4 @@ checked: columnIsAlreadyAggValue && columnToUse.getAggFunc() === funcName | ||
__decorate([ | ||
core_1.Autowired('columnController') | ||
], MenuItemMapper.prototype, "columnController", void 0); | ||
core_1.Autowired('columnModel') | ||
], MenuItemMapper.prototype, "columnModel", void 0); | ||
__decorate([ | ||
@@ -411,0 +411,0 @@ core_1.Autowired('gridApi') |
@@ -1,7 +0,9 @@ | ||
import { ManagedFocusComponent, MenuItemDef } from "@ag-grid-community/core"; | ||
export declare class MenuList extends ManagedFocusComponent { | ||
import { TabGuardComp, MenuItemDef } from "@ag-grid-community/core"; | ||
export declare class MenuList extends TabGuardComp { | ||
private readonly level; | ||
private readonly focusService; | ||
private menuItems; | ||
private activeMenuItem; | ||
constructor(level?: number); | ||
private postConstruct; | ||
protected onTabKeyDown(e: KeyboardEvent): void; | ||
@@ -8,0 +10,0 @@ protected handleKeyDown(e: KeyboardEvent): void; |
@@ -26,2 +26,8 @@ "use strict"; | ||
}; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -34,3 +40,3 @@ var core_1 = require("@ag-grid-community/core"); | ||
if (level === void 0) { level = 1; } | ||
var _this = _super.call(this, /* html */ "<div class=\"ag-menu-list\" role=\"tree\"></div>", true) || this; | ||
var _this = _super.call(this, /* html */ "<div class=\"ag-menu-list\" role=\"tree\"></div>") || this; | ||
_this.level = level; | ||
@@ -40,5 +46,13 @@ _this.menuItems = []; | ||
} | ||
MenuList.prototype.postConstruct = function () { | ||
var _this = this; | ||
this.initialiseTabGuard({ | ||
onTabKeyDown: function (e) { return _this.onTabKeyDown(e); }, | ||
handleKeyDown: function (e) { return _this.handleKeyDown(e); } | ||
}); | ||
}; | ||
MenuList.prototype.onTabKeyDown = function (e) { | ||
var parent = this.getParentComponent(); | ||
var isManaged = parent && parent instanceof core_1.ManagedFocusComponent; | ||
var parentGui = parent && parent.getGui(); | ||
var isManaged = parentGui && core_1._.containsClass(parentGui, 'ag-focus-managed'); | ||
if (!isManaged) { | ||
@@ -63,3 +77,3 @@ e.preventDefault(); | ||
if (topMenu) { | ||
this.focusController.focusInto(topMenu.getGui()); | ||
this.focusService.focusInto(topMenu.getGui()); | ||
} | ||
@@ -197,5 +211,11 @@ break; | ||
}; | ||
__decorate([ | ||
core_1.Autowired('focusService') | ||
], MenuList.prototype, "focusService", void 0); | ||
__decorate([ | ||
core_1.PostConstruct | ||
], MenuList.prototype, "postConstruct", null); | ||
return MenuList; | ||
}(core_1.ManagedFocusComponent)); | ||
}(core_1.TabGuardComp)); | ||
exports.MenuList = MenuList; | ||
//# sourceMappingURL=menuList.js.map |
@@ -1,8 +0,9 @@ | ||
import { ManagedFocusComponent, IComponent } from '@ag-grid-community/core'; | ||
export declare class MenuPanel extends ManagedFocusComponent { | ||
import { TabGuardComp, IComponent } from '@ag-grid-community/core'; | ||
export declare class MenuPanel extends TabGuardComp { | ||
private readonly wrappedComponent; | ||
constructor(wrappedComponent: IComponent<any>); | ||
handleKeyDown(e: KeyboardEvent): void; | ||
onTabKeyDown(e: KeyboardEvent): void; | ||
private postConstruct; | ||
private handleKeyDown; | ||
private onTabKeyDown; | ||
private closePanel; | ||
} |
@@ -15,2 +15,8 @@ "use strict"; | ||
})(); | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -21,3 +27,3 @@ var core_1 = require("@ag-grid-community/core"); | ||
function MenuPanel(wrappedComponent) { | ||
var _this = _super.call(this, undefined, true) || this; | ||
var _this = _super.call(this) || this; | ||
_this.wrappedComponent = wrappedComponent; | ||
@@ -27,2 +33,9 @@ _this.setTemplateFromElement(wrappedComponent.getGui()); | ||
} | ||
MenuPanel.prototype.postConstruct = function () { | ||
var _this = this; | ||
this.initialiseTabGuard({ | ||
onTabKeyDown: function (e) { return _this.onTabKeyDown(e); }, | ||
handleKeyDown: function (e) { return _this.handleKeyDown(e); } | ||
}); | ||
}; | ||
MenuPanel.prototype.handleKeyDown = function (e) { | ||
@@ -34,3 +47,2 @@ if (e.keyCode === core_1.KeyCode.ESCAPE) { | ||
MenuPanel.prototype.onTabKeyDown = function (e) { | ||
_super.prototype.onTabKeyDown.call(this, e); | ||
if (e.defaultPrevented) { | ||
@@ -47,5 +59,8 @@ return; | ||
}; | ||
__decorate([ | ||
core_1.PostConstruct | ||
], MenuPanel.prototype, "postConstruct", null); | ||
return MenuPanel; | ||
}(core_1.ManagedFocusComponent)); | ||
}(core_1.TabGuardComp)); | ||
exports.MenuPanel = MenuPanel; | ||
//# sourceMappingURL=menuPanel.js.map |
@@ -1,9 +0,8 @@ | ||
import { BeanStub, Column, GridBodyComp, IContextMenuFactory, RowNode } from "@ag-grid-community/core"; | ||
import { BeanStub, Column, IContextMenuFactory, RowNode } from "@ag-grid-community/core"; | ||
export declare class ContextMenuFactory extends BeanStub implements IContextMenuFactory { | ||
private popupService; | ||
private rangeController; | ||
private columnController; | ||
private rangeService; | ||
private ctrlsService; | ||
private columnModel; | ||
private activeMenu; | ||
private gridBodyComp; | ||
registerGridComp(gridBodyComp: GridBodyComp): void; | ||
hideActiveMenu(): void; | ||
@@ -10,0 +9,0 @@ private getMenuItems; |
@@ -30,5 +30,2 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
ContextMenuFactory.prototype.registerGridComp = function (gridBodyComp) { | ||
this.gridBodyComp = gridBodyComp; | ||
}; | ||
ContextMenuFactory.prototype.hideActiveMenu = function () { | ||
@@ -48,6 +45,6 @@ this.destroyBean(this.activeMenu); | ||
ModuleRegistry.isRegistered(ModuleNames.GridChartsModule)) { | ||
if (this.columnController.isPivotMode()) { | ||
if (this.columnModel.isPivotMode()) { | ||
defaultMenuOptions.push('pivotChart'); | ||
} | ||
if (this.rangeController && !this.rangeController.isEmpty()) { | ||
if (this.rangeService && !this.rangeService.isEmpty()) { | ||
defaultMenuOptions.push('chartRange'); | ||
@@ -92,2 +89,7 @@ } | ||
} | ||
// need to do this regardless of context menu showing or not, so doing | ||
// before the isSuppressContextMenu() check | ||
if (mouseEvent) { | ||
this.preventDefaultOnContextMenu(mouseEvent); | ||
} | ||
if (this.gridOptionsWrapper.isSuppressContextMenu()) { | ||
@@ -101,5 +103,2 @@ return; | ||
} | ||
if (mouseEvent) { | ||
this.preventDefaultOnContextMenu(mouseEvent); | ||
} | ||
}; | ||
@@ -121,3 +120,3 @@ ContextMenuFactory.prototype.preventDefaultOnContextMenu = function (mouseEvent) { | ||
var menuItems = this.getMenuItems(node, column, value); | ||
var eGridBodyGui = this.gridBodyComp.getGui(); | ||
var eGridBodyGui = this.ctrlsService.getGridBodyCtrl().getGui(); | ||
if (menuItems === undefined || _.missingOrEmpty(menuItems)) { | ||
@@ -137,6 +136,4 @@ return false; | ||
// won't show the browser's contextmenu | ||
nudgeX: 1, | ||
nudgeY: 1 | ||
}; | ||
var positionCallback = this.popupService.positionPopupUnderMouseEvent.bind(this.popupService, positionParams); | ||
var addPopupRes = this.popupService.addPopup({ | ||
@@ -151,3 +148,7 @@ modal: true, | ||
click: mouseEvent, | ||
positionCallback: positionCallback, | ||
positionCallback: function () { | ||
_this.popupService.positionPopupUnderMouseEvent(_.assign({}, { | ||
nudgeX: _this.gridOptionsWrapper.isEnableRtl() ? (eMenuGui.offsetWidth + 1) * -1 : 1 | ||
}, positionParams)); | ||
}, | ||
// so when browser is scrolled down, or grid is scrolled, context menu stays with cell | ||
@@ -184,7 +185,10 @@ anchorToElement: anchorToElement | ||
__decorate([ | ||
Optional('rangeController') | ||
], ContextMenuFactory.prototype, "rangeController", void 0); | ||
Optional('rangeService') | ||
], ContextMenuFactory.prototype, "rangeService", void 0); | ||
__decorate([ | ||
Autowired('columnController') | ||
], ContextMenuFactory.prototype, "columnController", void 0); | ||
Autowired('ctrlsService') | ||
], ContextMenuFactory.prototype, "ctrlsService", void 0); | ||
__decorate([ | ||
Autowired('columnModel') | ||
], ContextMenuFactory.prototype, "columnModel", void 0); | ||
ContextMenuFactory = __decorate([ | ||
@@ -218,9 +222,9 @@ Bean('contextMenuFactory') | ||
} | ||
this.focusedCell = this.focusController.getFocusedCell(); | ||
this.focusedCell = this.focusService.getFocusedCell(); | ||
if (this.menuList) { | ||
this.focusController.focusInto(this.menuList.getGui()); | ||
this.focusService.focusInto(this.menuList.getGui()); | ||
} | ||
}; | ||
ContextMenu.prototype.restoreFocusedCell = function () { | ||
var currentFocusedCell = this.focusController.getFocusedCell(); | ||
var currentFocusedCell = this.focusService.getFocusedCell(); | ||
if (currentFocusedCell && this.focusedCell && this.cellPositionUtils.equals(currentFocusedCell, this.focusedCell)) { | ||
@@ -230,3 +234,3 @@ var _a = this.focusedCell, rowIndex = _a.rowIndex, rowPinned = _a.rowPinned, column = _a.column; | ||
if (doc.activeElement === doc.body) { | ||
this.focusController.setFocusedCell(rowIndex, column, rowPinned, true); | ||
this.focusService.setFocusedCell(rowIndex, column, rowPinned, true); | ||
} | ||
@@ -243,4 +247,4 @@ } | ||
__decorate([ | ||
Autowired('focusController') | ||
], ContextMenu.prototype, "focusController", void 0); | ||
Autowired('focusService') | ||
], ContextMenu.prototype, "focusService", void 0); | ||
__decorate([ | ||
@@ -247,0 +251,0 @@ Autowired('cellPositionUtils') |
@@ -1,3 +0,2 @@ | ||
import { AgEvent, BeanStub, Column, IMenuFactory, GridBodyComp } from '@ag-grid-community/core'; | ||
import { AfterGuiAttachedParams } from '@ag-grid-community/core/dist/cjs/widgets/popupService'; | ||
import { AgEvent, BeanStub, Column, IMenuFactory, IAfterGuiAttachedParams, ContainerType } from '@ag-grid-community/core'; | ||
export interface TabSelectedEvent extends AgEvent { | ||
@@ -8,11 +7,10 @@ key: string; | ||
private popupService; | ||
private focusController; | ||
private focusService; | ||
private ctrlsService; | ||
private lastSelectedTab; | ||
private activeMenu; | ||
private gridBodyComp; | ||
registerGridComp(gridBodyComp: GridBodyComp): void; | ||
hideActiveMenu(): void; | ||
showMenuAfterMouseEvent(column: Column, mouseEvent: MouseEvent, defaultTab?: string): void; | ||
showMenuAfterButtonClick(column: Column, eventSource: HTMLElement, defaultTab?: string, restrictToTabs?: string[]): void; | ||
showMenu(column: Column, positionCallback: (menu: EnterpriseMenu) => void, defaultTab?: string, restrictToTabs?: string[], eventSource?: HTMLElement): void; | ||
showMenuAfterButtonClick(column: Column, eventSource: HTMLElement, containerType: ContainerType, defaultTab?: string, restrictToTabs?: string[]): void; | ||
showMenu(column: Column, positionCallback: (menu: EnterpriseMenu) => void, containerType: ContainerType, defaultTab?: string, restrictToTabs?: string[], eventSource?: HTMLElement): void; | ||
isMenuEnabled(column: Column): boolean; | ||
@@ -27,3 +25,3 @@ } | ||
static MENU_ITEM_SEPARATOR: string; | ||
private columnController; | ||
private columnModel; | ||
private filterManager; | ||
@@ -34,3 +32,3 @@ private gridApi; | ||
private rowModel; | ||
private focusController; | ||
private focusService; | ||
private tabbedLayout; | ||
@@ -48,8 +46,3 @@ private hidePopupFunc; | ||
private restrictTo?; | ||
private timeOfLastColumnChange; | ||
constructor(column: Column, initialSelection: string, restrictTo?: string[]); | ||
getMinDimensions(): { | ||
width: number; | ||
height: number; | ||
}; | ||
init(): void; | ||
@@ -71,5 +64,4 @@ private getTabsToCreate; | ||
private createColumnsPanel; | ||
afterGuiAttached(params: AfterGuiAttachedParams): void; | ||
afterGuiAttached(params: IAfterGuiAttachedParams): void; | ||
getGui(): HTMLElement; | ||
private onDisplayedColumnsChanged; | ||
} |
@@ -20,3 +20,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
import { _, Autowired, Bean, BeanStub, Column, Constants, Events, ModuleNames, ModuleRegistry, PostConstruct, AgPromise, TabbedLayout } from '@ag-grid-community/core'; | ||
import { _, Autowired, Bean, BeanStub, Column, Constants, ModuleNames, ModuleRegistry, PostConstruct, AgPromise, TabbedLayout } from '@ag-grid-community/core'; | ||
import { MenuList } from './menuList'; | ||
@@ -30,5 +30,2 @@ import { MenuItemComponent } from './menuItemComponent'; | ||
} | ||
EnterpriseMenuFactory.prototype.registerGridComp = function (gridBodyComp) { | ||
this.gridBodyComp = gridBodyComp; | ||
}; | ||
EnterpriseMenuFactory.prototype.hideActiveMenu = function () { | ||
@@ -50,5 +47,5 @@ this.destroyBean(this.activeMenu); | ||
} | ||
}, defaultTab, undefined, mouseEvent.target); | ||
}, 'columnMenu', defaultTab, undefined, mouseEvent.target); | ||
}; | ||
EnterpriseMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, defaultTab, restrictToTabs) { | ||
EnterpriseMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource, containerType, defaultTab, restrictToTabs) { | ||
var _this = this; | ||
@@ -62,12 +59,8 @@ var multiplier = -1; | ||
this.showMenu(column, function (menu) { | ||
var minDims = menu.getMinDimensions(); | ||
var minWidth = minDims.width, minHeight = minDims.height; | ||
var ePopup = menu.getGui(); | ||
_this.popupService.positionPopupUnderComponent({ | ||
type: 'columnMenu', | ||
type: containerType, | ||
column: column, | ||
eventSource: eventSource, | ||
ePopup: ePopup, | ||
minWidth: minWidth, | ||
minHeight: minHeight, | ||
alignSide: alignSide, | ||
@@ -81,9 +74,9 @@ nudgeX: 9 * multiplier, | ||
} | ||
}, defaultTab, restrictToTabs, eventSource); | ||
}, containerType, defaultTab, restrictToTabs, eventSource); | ||
}; | ||
EnterpriseMenuFactory.prototype.showMenu = function (column, positionCallback, defaultTab, restrictToTabs, eventSource) { | ||
EnterpriseMenuFactory.prototype.showMenu = function (column, positionCallback, containerType, defaultTab, restrictToTabs, eventSource) { | ||
var _this = this; | ||
var menu = this.createBean(new EnterpriseMenu(column, this.lastSelectedTab, restrictToTabs)); | ||
var eMenuGui = menu.getGui(); | ||
var anchorToElement = eventSource || this.gridBodyComp.getGui(); | ||
var anchorToElement = eventSource || this.ctrlsService.getGridBodyCtrl().getGui(); | ||
var closedFuncs = []; | ||
@@ -95,3 +88,3 @@ closedFuncs.push(function (e) { | ||
if (isKeyboardEvent && eventSource && _.isVisible(eventSource)) { | ||
var focusableEl = _this.focusController.findTabbableParent(eventSource); | ||
var focusableEl = _this.focusService.findTabbableParent(eventSource); | ||
if (focusableEl) { | ||
@@ -111,3 +104,3 @@ focusableEl.focus(); | ||
}, | ||
afterGuiAttached: function (params) { return menu.afterGuiAttached(params); }, | ||
afterGuiAttached: function (params) { return menu.afterGuiAttached(_.assign({}, { container: containerType }, params)); }, | ||
positionCallback: function () { return positionCallback(menu); }, | ||
@@ -120,9 +113,11 @@ anchorToElement: anchorToElement | ||
// the menu would move as the user is using the columns tab inside the menu. | ||
var stopAnchoringFunc_1 = addPopupRes.stopAnchoringFunc; | ||
if (stopAnchoringFunc_1) { | ||
column.addEventListener(Column.EVENT_LEFT_CHANGED, stopAnchoringFunc_1); | ||
column.addEventListener(Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc_1); | ||
closedFuncs.push(function () { | ||
column.removeEventListener(Column.EVENT_LEFT_CHANGED, stopAnchoringFunc_1); | ||
column.removeEventListener(Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc_1); | ||
var stopAnchoringPromise = addPopupRes.stopAnchoringPromise; | ||
if (stopAnchoringPromise) { | ||
stopAnchoringPromise.then(function (stopAnchoringFunc) { | ||
column.addEventListener(Column.EVENT_LEFT_CHANGED, stopAnchoringFunc); | ||
column.addEventListener(Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc); | ||
closedFuncs.push(function () { | ||
column.removeEventListener(Column.EVENT_LEFT_CHANGED, stopAnchoringFunc); | ||
column.removeEventListener(Column.EVENT_VISIBLE_CHANGED, stopAnchoringFunc); | ||
}); | ||
}); | ||
@@ -133,2 +128,5 @@ } | ||
menu.showTabBasedOnPreviousSelection(); | ||
// reposition the menu because the method above could load | ||
// an element that is bigger than enterpriseMenu header. | ||
positionCallback(menu); | ||
} | ||
@@ -153,4 +151,7 @@ menu.addEventListener(EnterpriseMenu.EVENT_TAB_SELECTED, function (event) { | ||
__decorate([ | ||
Autowired('focusController') | ||
], EnterpriseMenuFactory.prototype, "focusController", void 0); | ||
Autowired('focusService') | ||
], EnterpriseMenuFactory.prototype, "focusService", void 0); | ||
__decorate([ | ||
Autowired('ctrlsService') | ||
], EnterpriseMenuFactory.prototype, "ctrlsService", void 0); | ||
EnterpriseMenuFactory = __decorate([ | ||
@@ -168,3 +169,2 @@ Bean('menuFactory') | ||
_this.includeChecks = {}; | ||
_this.timeOfLastColumnChange = Date.now(); | ||
_this.column = column; | ||
@@ -181,5 +181,2 @@ _this.initialSelection = initialSelection; | ||
} | ||
EnterpriseMenu.prototype.getMinDimensions = function () { | ||
return this.tabbedLayout.getMinDimensions(); | ||
}; | ||
EnterpriseMenu.prototype.init = function () { | ||
@@ -198,3 +195,2 @@ var _this = this; | ||
} | ||
this.addManagedListener(this.eventService, Events.EVENT_DISPLAYED_COLUMNS_CHANGED, this.onDisplayedColumnsChanged.bind(this)); | ||
}; | ||
@@ -302,9 +298,9 @@ EnterpriseMenu.prototype.getTabsToCreate = function () { | ||
var allowPinning = !this.column.getColDef().lockPinned; | ||
var rowGroupCount = this.columnController.getRowGroupColumns().length; | ||
var rowGroupCount = this.columnModel.getRowGroupColumns().length; | ||
var doingGrouping = rowGroupCount > 0; | ||
var groupedByThisColumn = this.columnController.getRowGroupColumns().indexOf(this.column) >= 0; | ||
var groupedByThisColumn = this.columnModel.getRowGroupColumns().indexOf(this.column) >= 0; | ||
var allowValue = this.column.isAllowValue(); | ||
var allowRowGroup = this.column.isAllowRowGroup(); | ||
var isPrimary = this.column.isPrimary(); | ||
var pivotModeOn = this.columnController.isPivotMode(); | ||
var pivotModeOn = this.columnModel.isPivotMode(); | ||
var isInMemoryRowModel = this.rowModel.getType() === Constants.ROW_MODEL_TYPE_CLIENT_SIDE; | ||
@@ -368,6 +364,6 @@ var usingTreeData = this.gridOptionsWrapper.isTreeData(); | ||
// in this case we highlight the cell that was previously highlighted | ||
var focusedCell = this.focusController.getFocusedCell(); | ||
var focusedCell = this.focusService.getFocusedCell(); | ||
if (focusedCell) { | ||
var rowIndex = focusedCell.rowIndex, rowPinned = focusedCell.rowPinned, column = focusedCell.column; | ||
this.focusController.setFocusedCell(rowIndex, column, rowPinned, true); | ||
this.focusService.setFocusedCell(rowIndex, column, rowPinned, true); | ||
} | ||
@@ -432,6 +428,8 @@ }; | ||
EnterpriseMenu.prototype.afterGuiAttached = function (params) { | ||
var hidePopup = params.hidePopup; | ||
this.tabbedLayout.setAfterAttachedParams({ container: 'columnMenu', hidePopup: hidePopup }); | ||
this.hidePopupFunc = hidePopup; | ||
this.addDestroyFunc(hidePopup); | ||
var container = params.container, hidePopup = params.hidePopup; | ||
this.tabbedLayout.setAfterAttachedParams({ container: container, hidePopup: hidePopup }); | ||
if (hidePopup) { | ||
this.hidePopupFunc = hidePopup; | ||
this.addDestroyFunc(hidePopup); | ||
} | ||
}; | ||
@@ -441,5 +439,2 @@ EnterpriseMenu.prototype.getGui = function () { | ||
}; | ||
EnterpriseMenu.prototype.onDisplayedColumnsChanged = function () { | ||
this.timeOfLastColumnChange = Date.now(); | ||
}; | ||
EnterpriseMenu.EVENT_TAB_SELECTED = 'tabSelected'; | ||
@@ -452,4 +447,4 @@ EnterpriseMenu.TAB_FILTER = 'filterMenuTab'; | ||
__decorate([ | ||
Autowired('columnController') | ||
], EnterpriseMenu.prototype, "columnController", void 0); | ||
Autowired('columnModel') | ||
], EnterpriseMenu.prototype, "columnModel", void 0); | ||
__decorate([ | ||
@@ -471,4 +466,4 @@ Autowired('filterManager') | ||
__decorate([ | ||
Autowired('focusController') | ||
], EnterpriseMenu.prototype, "focusController", void 0); | ||
Autowired('focusService') | ||
], EnterpriseMenu.prototype, "focusService", void 0); | ||
__decorate([ | ||
@@ -475,0 +470,0 @@ PostConstruct |
import { BeanStub, Column, MenuItemDef } from '@ag-grid-community/core'; | ||
export declare class MenuItemMapper extends BeanStub { | ||
private columnController; | ||
private columnModel; | ||
private gridApi; | ||
@@ -5,0 +5,0 @@ private clipboardService; |
@@ -69,3 +69,3 @@ var __extends = (this && this.__extends) || (function () { | ||
name: localeTextFunc('pinLeft', 'Pin Left'), | ||
action: function () { return _this.columnController.setColumnPinned(column, Constants.PINNED_LEFT, "contextMenu"); }, | ||
action: function () { return _this.columnModel.setColumnPinned(column, Constants.PINNED_LEFT, "contextMenu"); }, | ||
checked: !!column && column.isPinnedLeft() | ||
@@ -76,3 +76,3 @@ }; | ||
name: localeTextFunc('pinRight', 'Pin Right'), | ||
action: function () { return _this.columnController.setColumnPinned(column, Constants.PINNED_RIGHT, "contextMenu"); }, | ||
action: function () { return _this.columnModel.setColumnPinned(column, Constants.PINNED_RIGHT, "contextMenu"); }, | ||
checked: !!column && column.isPinnedRight() | ||
@@ -83,3 +83,3 @@ }; | ||
name: localeTextFunc('noPin', 'No Pin'), | ||
action: function () { return _this.columnController.setColumnPinned(column, null, "contextMenu"); }, | ||
action: function () { return _this.columnModel.setColumnPinned(column, null, "contextMenu"); }, | ||
checked: !!column && !column.isPinned() | ||
@@ -101,3 +101,3 @@ }; | ||
name: localeTextFunc('autosizeThiscolumn', 'Autosize This Column'), | ||
action: function () { return _this.columnController.autoSizeColumn(column, skipHeaderOnAutoSize, "contextMenu"); } | ||
action: function () { return _this.columnModel.autoSizeColumn(column, skipHeaderOnAutoSize, "contextMenu"); } | ||
}; | ||
@@ -107,8 +107,8 @@ case 'autoSizeAll': | ||
name: localeTextFunc('autosizeAllColumns', 'Autosize All Columns'), | ||
action: function () { return _this.columnController.autoSizeAllColumns(skipHeaderOnAutoSize, "contextMenu"); } | ||
action: function () { return _this.columnModel.autoSizeAllColumns(skipHeaderOnAutoSize, "contextMenu"); } | ||
}; | ||
case 'rowGroup': | ||
return { | ||
name: localeTextFunc('groupBy', 'Group by') + ' ' + _.escapeString(this.columnController.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnController.addRowGroupColumn(column, "contextMenu"); }, | ||
name: localeTextFunc('groupBy', 'Group by') + ' ' + _.escapeString(this.columnModel.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnModel.addRowGroupColumn(column, "contextMenu"); }, | ||
icon: _.createIconNoSpan('menuAddRowGroup', this.gridOptionsWrapper, null) | ||
@@ -118,4 +118,4 @@ }; | ||
return { | ||
name: localeTextFunc('ungroupBy', 'Un-Group by') + ' ' + _.escapeString(this.columnController.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnController.removeRowGroupColumn(column, "contextMenu"); }, | ||
name: localeTextFunc('ungroupBy', 'Un-Group by') + ' ' + _.escapeString(this.columnModel.getDisplayNameForColumn(column, 'header')), | ||
action: function () { return _this.columnModel.removeRowGroupColumn(column, "contextMenu"); }, | ||
icon: _.createIconNoSpan('menuRemoveRowGroup', this.gridOptionsWrapper, null) | ||
@@ -126,3 +126,3 @@ }; | ||
name: localeTextFunc('resetColumns', 'Reset Columns'), | ||
action: function () { return _this.columnController.resetColumnState("contextMenu"); } | ||
action: function () { return _this.columnModel.resetColumnState("contextMenu"); } | ||
}; | ||
@@ -395,4 +395,4 @@ case 'expandAll': | ||
action: function () { | ||
_this.columnController.setColumnAggFunc(columnToUse, funcName, "contextMenu"); | ||
_this.columnController.addValueColumn(columnToUse, "contextMenu"); | ||
_this.columnModel.setColumnAggFunc(columnToUse, funcName, "contextMenu"); | ||
_this.columnModel.addValueColumn(columnToUse, "contextMenu"); | ||
}, | ||
@@ -405,4 +405,4 @@ checked: columnIsAlreadyAggValue && columnToUse.getAggFunc() === funcName | ||
__decorate([ | ||
Autowired('columnController') | ||
], MenuItemMapper.prototype, "columnController", void 0); | ||
Autowired('columnModel') | ||
], MenuItemMapper.prototype, "columnModel", void 0); | ||
__decorate([ | ||
@@ -409,0 +409,0 @@ Autowired('gridApi') |
@@ -1,7 +0,9 @@ | ||
import { ManagedFocusComponent, MenuItemDef } from "@ag-grid-community/core"; | ||
export declare class MenuList extends ManagedFocusComponent { | ||
import { TabGuardComp, MenuItemDef } from "@ag-grid-community/core"; | ||
export declare class MenuList extends TabGuardComp { | ||
private readonly level; | ||
private readonly focusService; | ||
private menuItems; | ||
private activeMenuItem; | ||
constructor(level?: number); | ||
private postConstruct; | ||
protected onTabKeyDown(e: KeyboardEvent): void; | ||
@@ -8,0 +10,0 @@ protected handleKeyDown(e: KeyboardEvent): void; |
@@ -25,3 +25,9 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
import { ManagedFocusComponent, _, KeyCode, } from "@ag-grid-community/core"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { TabGuardComp, KeyCode, Autowired, _, PostConstruct } from "@ag-grid-community/core"; | ||
import { MenuItemComponent } from "./menuItemComponent"; | ||
@@ -32,3 +38,3 @@ var MenuList = /** @class */ (function (_super) { | ||
if (level === void 0) { level = 1; } | ||
var _this = _super.call(this, /* html */ "<div class=\"ag-menu-list\" role=\"tree\"></div>", true) || this; | ||
var _this = _super.call(this, /* html */ "<div class=\"ag-menu-list\" role=\"tree\"></div>") || this; | ||
_this.level = level; | ||
@@ -38,5 +44,13 @@ _this.menuItems = []; | ||
} | ||
MenuList.prototype.postConstruct = function () { | ||
var _this = this; | ||
this.initialiseTabGuard({ | ||
onTabKeyDown: function (e) { return _this.onTabKeyDown(e); }, | ||
handleKeyDown: function (e) { return _this.handleKeyDown(e); } | ||
}); | ||
}; | ||
MenuList.prototype.onTabKeyDown = function (e) { | ||
var parent = this.getParentComponent(); | ||
var isManaged = parent && parent instanceof ManagedFocusComponent; | ||
var parentGui = parent && parent.getGui(); | ||
var isManaged = parentGui && _.containsClass(parentGui, 'ag-focus-managed'); | ||
if (!isManaged) { | ||
@@ -61,3 +75,3 @@ e.preventDefault(); | ||
if (topMenu) { | ||
this.focusController.focusInto(topMenu.getGui()); | ||
this.focusService.focusInto(topMenu.getGui()); | ||
} | ||
@@ -195,4 +209,10 @@ break; | ||
}; | ||
__decorate([ | ||
Autowired('focusService') | ||
], MenuList.prototype, "focusService", void 0); | ||
__decorate([ | ||
PostConstruct | ||
], MenuList.prototype, "postConstruct", null); | ||
return MenuList; | ||
}(ManagedFocusComponent)); | ||
}(TabGuardComp)); | ||
export { MenuList }; |
@@ -1,8 +0,9 @@ | ||
import { ManagedFocusComponent, IComponent } from '@ag-grid-community/core'; | ||
export declare class MenuPanel extends ManagedFocusComponent { | ||
import { TabGuardComp, IComponent } from '@ag-grid-community/core'; | ||
export declare class MenuPanel extends TabGuardComp { | ||
private readonly wrappedComponent; | ||
constructor(wrappedComponent: IComponent<any>); | ||
handleKeyDown(e: KeyboardEvent): void; | ||
onTabKeyDown(e: KeyboardEvent): void; | ||
private postConstruct; | ||
private handleKeyDown; | ||
private onTabKeyDown; | ||
private closePanel; | ||
} |
@@ -14,7 +14,13 @@ var __extends = (this && this.__extends) || (function () { | ||
})(); | ||
import { ManagedFocusComponent, KeyCode } from '@ag-grid-community/core'; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { TabGuardComp, KeyCode, PostConstruct } from '@ag-grid-community/core'; | ||
var MenuPanel = /** @class */ (function (_super) { | ||
__extends(MenuPanel, _super); | ||
function MenuPanel(wrappedComponent) { | ||
var _this = _super.call(this, undefined, true) || this; | ||
var _this = _super.call(this) || this; | ||
_this.wrappedComponent = wrappedComponent; | ||
@@ -24,2 +30,9 @@ _this.setTemplateFromElement(wrappedComponent.getGui()); | ||
} | ||
MenuPanel.prototype.postConstruct = function () { | ||
var _this = this; | ||
this.initialiseTabGuard({ | ||
onTabKeyDown: function (e) { return _this.onTabKeyDown(e); }, | ||
handleKeyDown: function (e) { return _this.handleKeyDown(e); } | ||
}); | ||
}; | ||
MenuPanel.prototype.handleKeyDown = function (e) { | ||
@@ -31,3 +44,2 @@ if (e.keyCode === KeyCode.ESCAPE) { | ||
MenuPanel.prototype.onTabKeyDown = function (e) { | ||
_super.prototype.onTabKeyDown.call(this, e); | ||
if (e.defaultPrevented) { | ||
@@ -44,4 +56,7 @@ return; | ||
}; | ||
__decorate([ | ||
PostConstruct | ||
], MenuPanel.prototype, "postConstruct", null); | ||
return MenuPanel; | ||
}(ManagedFocusComponent)); | ||
}(TabGuardComp)); | ||
export { MenuPanel }; |
{ | ||
"name": "@ag-grid-enterprise/menu", | ||
"version": "25.3.0", | ||
"version": "26.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components", | ||
@@ -9,4 +9,4 @@ "main": "./dist/cjs/main.js", | ||
"scripts": { | ||
"build-cjs": "tsc -p tsconfig.json", | ||
"build-es6": "tsc -p tsconfig.es6.json", | ||
"build-cjs": "npx tsc -p tsconfig.json", | ||
"build-es6": "npx tsc -p tsconfig.es6.json", | ||
"package": "node ../../module-build/rollup/build.js", | ||
@@ -46,5 +46,5 @@ "build": "npm run build-cjs && npm run build-es6 && npm run hash", | ||
"dependencies": { | ||
"@ag-grid-community/core": "~25.3.0", | ||
"@ag-grid-enterprise/core": "~25.3.0", | ||
"@ag-grid-enterprise/column-tool-panel": "~25.3.0" | ||
"@ag-grid-community/core": "~26.0.0", | ||
"@ag-grid-enterprise/core": "~26.0.0", | ||
"@ag-grid-enterprise/column-tool-panel": "~26.0.0" | ||
}, | ||
@@ -51,0 +51,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
573850
7191
1
1
+ Added@ag-grid-community/core@26.0.0(transitive)
+ Added@ag-grid-enterprise/column-tool-panel@26.0.0(transitive)
+ Added@ag-grid-enterprise/core@26.0.0(transitive)
+ Added@ag-grid-enterprise/row-grouping@26.0.0(transitive)
+ Added@ag-grid-enterprise/side-bar@26.0.0(transitive)
- Removed@ag-grid-community/core@25.3.0(transitive)
- Removed@ag-grid-enterprise/column-tool-panel@25.3.0(transitive)
- Removed@ag-grid-enterprise/core@25.3.0(transitive)
- Removed@ag-grid-enterprise/row-grouping@25.3.0(transitive)
- Removed@ag-grid-enterprise/side-bar@25.3.0(transitive)