mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2859] conditional evaluation of disabled state for content actions (#3450)
* react on [disabled] binding changes * [disabled] binding updates for context menu items * evaluating disabled state with a function * unit test * restore original description * remove irrelevant test * fix tests
This commit is contained in:
committed by
Eugenio Romano
parent
08fd49c4e3
commit
cb88a22a76
@@ -66,7 +66,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
/** Is the menu item disabled? */
|
||||
@Input()
|
||||
disabled: boolean = false;
|
||||
disabled: boolean | Function = false;
|
||||
|
||||
/** Emitted when the user selects the action from the menu. */
|
||||
@Output()
|
||||
@@ -117,6 +117,15 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.folderActionModel.visible = changes.visible.currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (changes.disabled && !changes.disabled.firstChange) {
|
||||
if (this.documentActionModel) {
|
||||
this.documentActionModel.disabled = changes.disabled.currentValue;
|
||||
}
|
||||
if (this.folderActionModel) {
|
||||
this.folderActionModel.disabled = changes.disabled.currentValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
Reference in New Issue
Block a user