Add support for "More Actions" column in Resource Viewer (#13093)

* Add support for "More Actions" column in resource viewer

* update provider

* remove import

* Use menu contribution and make actions column always show

* cleanup

* move context menu anchor

* Comments
This commit is contained in:
Charles Gagnon
2020-10-29 10:50:27 -07:00
committed by GitHub
parent 10f6fe2d09
commit 66da2a46c5
12 changed files with 189 additions and 43 deletions

View File

@@ -16,6 +16,7 @@ export interface DBCellValue {
*/
export interface ExecuteCommandInfo {
id: string;
displayText?: string;
args?: string[]
}
@@ -49,7 +50,6 @@ export function isHyperlinkCellValue(obj: any | undefined): obj is HyperlinkCell
return !!(<HyperlinkCellValue>obj)?.linkOrCommand;
}
/**
* Format xml field into a hyperlink and performs HTML entity encoding
*/
@@ -107,8 +107,7 @@ export function imageFormatter(row: number | undefined, cell: any | undefined, v
}
/**
* Provide slick grid cell with encoded ariaLabel and plain text.
* text will be escaped by the textFormatter and ariaLabel will be consumed by slickgrid directly.
* Extracts the specified field into the expected object to be handled by SlickGrid and/or formatters as needed.
*/
export function slickGridDataItemColumnValueExtractor(value: any, columnDef: any): TextCellValue | HyperlinkCellValue {
let fieldValue = value[columnDef.field];
@@ -123,7 +122,6 @@ export function slickGridDataItemColumnValueExtractor(value: any, columnDef: any
ariaLabel: fieldValue ? escape(fieldValue) : fieldValue
};
}
}
/**

View File

@@ -12,9 +12,22 @@ export interface ButtonColumnDefinition<T extends Slick.SlickData> extends TextW
}
export interface ButtonColumnOptions {
/**
* The CSS class of the icon (either a common icon or one added by the user of this column) to display in the button
*/
iconCssClass?: string;
/**
* The aria-label title of the button
*/
title?: string;
/**
* The unique ID used by SlickGrid
*/
id?: string;
/**
* Whether the column is sortable or not
*/
sortable?: boolean;
}
export interface ButtonClickEventArgs<T extends Slick.SlickData> {
@@ -41,7 +54,8 @@ export class ButtonColumn<T extends Slick.SlickData> implements Slick.Plugin<T>
},
width: 30,
selectable: false,
iconCssClassField: options.iconCssClass
iconCssClassField: options.iconCssClass,
sortable: options.sortable
};
}

View File

@@ -241,6 +241,10 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
this._grid.registerPlugin(plugin);
}
unregisterPlugin(plugin: Slick.Plugin<T>): void {
this._grid.unregisterPlugin(plugin);
}
/**
* This function needs to be called if the table is drawn off dom.
*/