LP#1808268 eg2 grid rename action disable option
authorBill Erickson <berickxx@gmail.com>
Mon, 17 Dec 2018 15:56:36 +0000 (10:56 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 23 Jan 2019 16:54:20 +0000 (11:54 -0500)
Rename the "disabled" attribute on toolbar-action to "disabeOnRows" to
better clarify the expected input value: function returning bool instead
of bool variable.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>

Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid.ts
Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html

index 6b6114f..85211e6 100644 (file)
@@ -16,7 +16,7 @@ export class GridToolbarActionComponent implements OnInit {
     // Optional: add a function that returns true or false.
     // If true, this action will be disabled; if false
     // (default behavior), the action will be enabled.
-    @Input() disabled: (rows: any[]) => boolean;
+    @Input() disableOnRows: (rows: any[]) => boolean;
 
     // get a reference to our container grid.
     constructor(@Host() private grid: GridComponent) {}
@@ -32,8 +32,8 @@ export class GridToolbarActionComponent implements OnInit {
         action.label = this.label;
         action.action = this.action;
 
-        action.disabled = (this.disabled == null) ? (rows: any[]) => false : this.disabled;
-
+        action.disableOnRows = (this.disableOnRows === null) ?
+            (rows: any[]) => false : this.disableOnRows;
 
         this.grid.context.toolbarActions.push(action);
     }
index a133623..93df402 100644 (file)
@@ -42,7 +42,7 @@ export class GridToolbarComponent implements OnInit {
     }
 
     shouldDisableAction(action: GridToolbarAction) {
-        return action.disabled(this.gridContext.getSelectedRows());
+        return action.disableOnRows(this.gridContext.getSelectedRows());
     }
 
     printHtml() {
index 35ca542..8a777e4 100644 (file)
@@ -890,7 +890,7 @@ export class GridContext {
 export class GridToolbarAction {
     label: string;
     action: (rows: any[]) => any;
-    disabled: (rows: any[]) => boolean;
+    disableOnRows: (rows: any[]) => boolean;
 }
 
 // Buttons are global actions
index 66398fe..8249335 100644 (file)
@@ -122,7 +122,8 @@ HERasdfE
   [rowFlairCallback]="btGridRowFlairCallback"
   [cellClassCallback]="btGridCellClassCallback"
   [sortable]="true">
-  <eg-grid-toolbar-action label="Action that needs a single row" i18n-label [action]="complimentEvergreen" [disabled]="notOneSelectedRow">
+  <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
+    [action]="complimentEvergreen" [disableOnRows]="notOneSelectedRow">
   </eg-grid-toolbar-action>
   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
     [cellContext]="btGridTestContext" [sortable]="false">