From: Bill Erickson Date: Mon, 26 Nov 2018 18:20:47 +0000 (+0000) Subject: LP1803787 Grid toolbar action separators X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=45fee35ff3f79ed68b120c341005e1cffd75af9d;p=working%2FEvergreen.git LP1803787 Grid toolbar action separators Add support for "separator" toolbar actions so the action menu may be divided into groups. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts index 4f8555404f..6ebe6de080 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts @@ -26,11 +26,11 @@ export class GridToolbarActionComponent implements OnInit { // (default behavior), the action will be enabled. @Input() disableOnRows: (rows: any[]) => boolean; + // If true, render a separator bar only, no action link. + @Input() separator: boolean; // get a reference to our container grid. - constructor(@Host() private grid: GridComponent) { - this.onClick = new EventEmitter(); - } + constructor(@Host() private grid: GridComponent) { } ngOnInit() { @@ -42,9 +42,14 @@ export class GridToolbarActionComponent implements OnInit { const action = new GridToolbarAction(); action.label = this.label; action.action = this.action; - action.onClick = this.onClick; action.group = this.group; + action.separator = this.separator; action.disableOnRows = this.disableOnRows; + + if (!this.separator) { + action.onClick = this.onClick = new EventEmitter(); + } + this.grid.context.toolbarActions.push(action); } } diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html index 5dd307f4f9..cd2bac2854 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html @@ -42,11 +42,15 @@ {{action.label}} + + + {{action.label}} - + {{action.label}} diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index 7c30438ccc..695a828249 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -928,6 +928,7 @@ export class GridToolbarAction { action: (rows: any[]) => any; // DEPRECATED group: string; isGroup: boolean; // used for group placeholder entries + separator: boolean; disableOnRows: (rows: any[]) => boolean; }