提交 eb5f9bec 编写于 作者: J Johannes Rieken

make SubmenuEntryActionViewItem not eagerly fetch/create the actual actions

上级 137b6f5a
......@@ -16,7 +16,7 @@ export interface IContextMenuEvent {
export interface IContextMenuDelegate {
getAnchor(): HTMLElement | { x: number; y: number; width?: number; height?: number; };
getActions(): IAction[];
getActions(): readonly IAction[];
getCheckedActionsRepresentation?(action: IAction): 'radio' | 'checkbox';
getActionViewItem?(action: IAction): IActionViewItem | undefined;
getActionsContext?(event?: IContextMenuEvent): any;
......
......@@ -201,7 +201,7 @@ export class Dropdown extends BaseDropdown {
}
export interface IActionProvider {
getActions(): IAction[];
getActions(): readonly IAction[];
}
export interface IDropdownMenuOptions extends IBaseDropdownOptions {
......@@ -215,7 +215,7 @@ export interface IDropdownMenuOptions extends IBaseDropdownOptions {
export class DropdownMenu extends BaseDropdown {
private _contextMenuProvider: IContextMenuProvider;
private _menuOptions: IMenuOptions | undefined;
private _actions: IAction[] = [];
private _actions: readonly IAction[] = [];
private actionProvider?: IActionProvider;
private menuClassName: string;
private menuAsChild?: boolean;
......@@ -238,7 +238,7 @@ export class DropdownMenu extends BaseDropdown {
return this._menuOptions;
}
private get actions(): IAction[] {
private get actions(): readonly IAction[] {
if (this.actionProvider) {
return this.actionProvider.getActions();
}
......@@ -246,7 +246,7 @@ export class DropdownMenu extends BaseDropdown {
return this._actions;
}
private set actions(actions: IAction[]) {
private set actions(actions: readonly IAction[]) {
this._actions = actions;
}
......
......@@ -206,7 +206,7 @@ export class SubmenuEntryActionViewItem extends DropdownMenuActionViewItem {
action: SubmenuItemAction,
@IContextMenuService contextMenuService: IContextMenuService
) {
super(action, action.actions, contextMenuService, {
super(action, { getActions: () => action.actions }, contextMenuService, {
menuAsChild: true,
classNames: ThemeIcon.isThemeIcon(action.item.icon) ? ThemeIcon.asClassName(action.item.icon) : undefined,
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册