From 65ec34041b6a925b63abc879c3eda458c08eff32 Mon Sep 17 00:00:00 2001 From: Mario Romano Date: Fri, 12 Aug 2016 12:32:28 +0100 Subject: [PATCH] #540 hide/show save and complete button forms --- .../components/activiti-form.component.css | 4 ++++ .../components/activiti-form.component.html | 1 + .../src/components/activiti-form.component.ts | 23 ++++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.css b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.css index 34500e7278..6eb9bd0de9 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.css +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.css @@ -19,3 +19,7 @@ .activiti-form-debug-container .debug-toggle-text:hover { font-weight: bold; } + +.activiti-form-hide-button { + display: none; +} diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html index ebb380d9ff..b269a29029 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.html @@ -20,6 +20,7 @@ diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts index 22662f8910..a1914b1055 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts @@ -53,6 +53,10 @@ declare var componentHandler; * * {showRefreshButton} boolean - to hide the refresh button of the form pass false, default true; * + * {showCompleteButton} boolean - to hide the complete button of the form pass false, default true; + * + * {showSaveButton} boolean - to hide the save button of the form pass false, default true; + * * @Output * {formLoaded} EventEmitter - This event is fired when the form is loaded, it pass all the value in the form. * {formsaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form. @@ -85,6 +89,12 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { @Input() showTitle: boolean = true; + @Input() + showCompleteButton: boolean = true; + + @Input() + showSaveButton: boolean = true; + @Input() readOnly: boolean = false; @@ -104,6 +114,9 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { debugMode: boolean = false; + constructor(private formService: FormService) { + } + hasForm(): boolean { return this.form ? true : false; } @@ -112,7 +125,15 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { return this.form.taskName && this.showTitle; } - constructor(private formService: FormService) {} + isOutcomeButtonEnabled(outcome: any): boolean { + if (outcome.name === 'Complete') { + return this.showCompleteButton; + } + if (outcome.name === 'Save') { + return this.showSaveButton; + } + return true; + } ngOnInit() { if (this.taskId) {